private function removeStagedQuestions() { $query = 'SELECT * FROM tst_rnd_cpy WHERE tst_fi = %s'; $res = $this->db->queryF($query, array('integer'), array($this->testOBJ->getTestId())); while ($row = $this->db->fetchAssoc($res)) { $question = assQuestion::_instanciateQuestion($row['qst_fi']); $question->delete($row['qst_fi']); } $query = "DELETE FROM tst_rnd_cpy WHERE tst_fi = %s"; $this->db->manipulateF($query, array('integer'), array($this->testOBJ->getTestId())); }
/** * @param assQuestion $question */ public function deleteTestsParticipantsResultsForQuestion(assQuestion $question) { $activeIds = $this->getActiveIds(); if (!count($activeIds)) { return null; } $inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer'); $this->db->manipulateF("DELETE FROM tst_solutions WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId())); $this->db->manipulateF("DELETE FROM tst_qst_solved WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId())); $this->db->manipulateF("DELETE FROM tst_test_result WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId())); $this->db->manipulate("DELETE FROM tst_pass_result WHERE {$inActiveIds}"); $this->db->manipulate("DELETE FROM tst_result_cache WHERE {$inActiveIds}"); }
private function removeStagedQuestions() { $query = 'SELECT * FROM tst_rnd_cpy WHERE tst_fi = %s'; $res = $this->db->queryF($query, array('integer'), array($this->testOBJ->getTestId())); while ($row = $this->db->fetchAssoc($res)) { $question = assQuestion::_instanciateQuestion($row['qst_fi']); if ($question instanceof assQuestion) { $question->delete($row['qst_fi']); } else { $GLOBALS['ilLog']->writeWarning("could not delete staged random question (ref={$this->testOBJ->getRefId()} / qst={$row['qst_fi']})"); } } $query = "DELETE FROM tst_rnd_cpy WHERE tst_fi = %s"; $this->db->manipulateF($query, array('integer'), array($this->testOBJ->getTestId())); }
private function deleteTestsParticipantsTrackingsForQuestion($activeIds, $questionId) { $inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer'); $tables = array('tst_seq_qst_tracking', 'tst_seq_qst_answstatus', 'tst_seq_qst_postponed', 'tst_seq_qst_checked'); foreach ($tables as $table) { $this->db->manipulateF("DELETE FROM {$table} WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($questionId)); } }
private function removeQuestionsNotCheckedAnymore() { $NOT_IN_checkedQuestions = $this->db->in('question_fi', $this->alreadyCheckedQuestions, true, 'integer'); // BEGIN: FIX IN QUERY if ($NOT_IN_checkedQuestions == ' 1=2 ') { $NOT_IN_checkedQuestions = ' 1=1 '; } // END: FIX IN QUERY $query = "\n\t\t\tDELETE FROM tst_seq_qst_checked\n\t\t\tWHERE active_fi = %s\n\t\t\tAND pass = %s\n\t\t\tAND {$NOT_IN_checkedQuestions}\n\t\t"; $this->db->manipulateF($query, array('integer', 'integer'), array((int) $this->getActiveId(), 0)); }
/** * syncs the GENERIC feedback from a duplicated question back to the original question * * @final * @access private * @param integer $originalQuestionId * @param integer $duplicateQuestionId */ private final function syncGenericFeedback($originalQuestionId, $duplicateQuestionId) { // delete generic feedback of the original question $this->db->manipulateF("DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($originalQuestionId)); // get generic feedback of the actual (duplicated) question $result = $this->db->queryF("SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($duplicateQuestionId)); // save generic feedback to the original question while ($row = $this->db->fetchAssoc($result)) { $nextId = $this->db->nextId($this->getGenericFeedbackTableName()); $this->db->insert($this->getGenericFeedbackTableName(), array('feedback_id' => array('integer', $nextId), 'question_fi' => array('integer', $originalQuestionId), 'correctness' => array('text', $row['correctness']), 'feedback' => array('clob', $row['feedback']), 'tstamp' => array('integer', time()))); } }
public function deleteFromDb() { $query = "\n\t\t\tDELETE FROM qpl_qst_skl_assigns\n\t\t\tWHERE obj_fi = %s\n\t\t\tAND question_fi = %s\n\t\t\tAND skill_base_fi = %s\n\t\t\tAND skill_tref_fi = %s\n\t\t"; $this->db->manipulateF($query, array('integer', 'integer', 'integer', 'integer'), array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())); $this->deleteComparisonExpressions(); }
public function deleteDefinitions() { $query = "DELETE FROM tst_rnd_quest_set_qpls WHERE test_fi = %s"; $this->db->manipulateF($query, array('integer'), array($this->testOBJ->getTestId())); }
public function deleteFromDb() { $this->db->manipulateF("DELETE FROM tst_rnd_quest_set_qpls WHERE def_id = %s", array('integer'), array($this->getId())); }
public function deleteFromDb() { $query = "\n\t\t\tDELETE FROM tst_skl_qst_assigns\n\t\t\tWHERE test_fi = %s\n\t\t\tAND question_fi = %s\n\t\t\tAND skill_base_fi = %s\n\t\t\tAND skill_tref_fi = %s\n\t\t"; $this->db->manipulateF($query, array('integer', 'integer', 'integer', 'integer'), array($this->getTestId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())); }
public function delete() { $query = "\n\t\t\tDELETE FROM qpl_qst_skl_sol_expr\n\t\t\tWHERE question_fi = %s AND skill_base_fi = %s AND skill_tref_fi = %s\n\t\t"; $this->db->manipulateF($query, array('integer', 'integer', 'integer'), array($this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())); }