Exemplo n.º 1
0
 public function getQuestionPoints($questionId, $type)
 {
     $pointList = QuestionPointBaseModel::instance()->getQuestionPoint($questionId, $type);
     $pointIds = array();
     foreach ($pointList as $point) {
         $pointIds[] = $point['point_id'];
     }
     $points = KeyPointBaseModel::instance()->getByIds($pointIds);
     return $points;
 }
 public function removePoint()
 {
     if (IS_AJAX) {
         $pointId = I('post.pointid', 0, 'intval');
         KeyPointBaseModel::instance()->delById($pointId);
         $res = KeyPointBaseModel::instance()->delByParentId($pointId);
         QuestionPointBaseModel::instance()->delPoint($pointId);
         echo $res;
     }
 }
Exemplo n.º 3
0
 public function fill()
 {
     $tmp = FillBaseModel::instance()->getById($this->id, array('creator', 'isprivate'));
     if (!$this->isProblemCanDelete($tmp['isprivate'], $tmp['creator'])) {
         $this->echoError('You have no privilege!');
     } else {
         FillBaseModel::instance()->delById($this->id);
         $sql = "DELETE FROM `fill_answer` WHERE `fill_id`={$this->id}";
         M()->execute($sql);
         $sql = "DELETE FROM `exp_question` WHERE `question_id`={$this->id} and `type`=3";
         M()->execute($sql);
         $sql = "DELETE FROM `ex_stuanswer` WHERE `question_id`={$this->id} and `type`=3";
         M()->execute($sql);
         QuestionPointBaseModel::instance()->delByQuestion($this->id, 3);
         $this->success("填空题删除成功", U("Teacher/Index/fill", array('page' => $this->page)), 2);
     }
 }
 protected function getQuestionChapterAndPoint($questionIds, $type)
 {
     $questionPoints = QuestionPointBaseModel::instance()->getQuestionsPoint($questionIds, $type);
     $questionPointMap = array();
     $pointIds = array();
     foreach ($questionPoints as $questionPoint) {
         $pointIds[] = $questionPoint['point_id'];
         $pointIds[] = $questionPoint['point_parent_id'];
     }
     $pointIds = array_unique($pointIds);
     $pointMap = array();
     $points = KeyPointBaseModel::instance()->getByIds($pointIds);
     foreach ($points as $point) {
         $pointMap[$point['id']] = $point['name'];
     }
     foreach ($questionPoints as $questionPoint) {
         if (!isset($questionPointMap[$questionPoint['question_id']])) {
             $questionPointMap[$questionPoint['question_id']] = array();
         }
         $questionPointMap[$questionPoint['question_id']][] = array('chapter' => $questionPoint['chapter_id'], 'parent_point' => $pointMap[$questionPoint['point_parent_id']], 'point' => $pointMap[$questionPoint['point_id']]);
     }
     $this->zadd('questionPointMap', $questionPointMap);
 }