public function saveToDb() { if ($this->dbRecordExists()) { $this->db->update('tst_skl_qst_assigns', array('skill_points' => array('integer', $this->getSkillPoints())), array('test_fi' => array('integer', $this->getTestId()), 'question_fi' => array('integer', $this->getQuestionId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()))); } else { $this->db->insert('tst_skl_qst_assigns', array('test_fi' => array('integer', $this->getTestId()), 'question_fi' => array('integer', $this->getQuestionId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()), 'skill_points' => array('integer', $this->getSkillPoints()))); } }
public function saveToDb() { if ($this->dbRecordExists()) { $this->db->update('tst_skl_thresholds', array('threshold' => array('integer', $this->getThreshold())), array('test_fi' => array('integer', $this->getTestId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()), 'skill_level_fi' => array('integer', $this->getSkillLevelId()))); } else { $this->db->insert('tst_skl_thresholds', array('test_fi' => array('integer', $this->getTestId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()), 'skill_level_fi' => array('integer', $this->getSkillLevelId()), 'threshold' => array('integer', $this->getThreshold()))); } }
public function saveToDb() { if ($this->dbRecordExists()) { $this->db->update('qpl_qst_skl_assigns', array('skill_points' => array('integer', $this->getSkillPoints()), 'eval_mode' => array('text', $this->getEvalMode())), array('obj_fi' => array('integer', $this->getParentObjId()), 'question_fi' => array('integer', $this->getQuestionId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()))); } else { $this->db->insert('qpl_qst_skl_assigns', array('obj_fi' => array('integer', $this->getParentObjId()), 'question_fi' => array('integer', $this->getQuestionId()), 'skill_base_fi' => array('integer', $this->getSkillBaseId()), 'skill_tref_fi' => array('integer', $this->getSkillTrefId()), 'skill_points' => array('integer', $this->getSkillPoints()), 'eval_mode' => array('text', $this->getEvalMode()))); } if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) { $this->saveComparisonExpressions(); } }
public function saveToDb() { $tracking = serialize($this->questionTracking); $postponed = serialize($this->postponedQuestions); $hidden = serialize(array('correct' => $this->correctAnsweredQuestions, 'wrong' => $this->wrongAnsweredQuestions)); $query = "SELECT COUNT(*) cnt FROM tst_sequence WHERE active_fi = %s AND pass = %s"; $res = $this->db->queryF($query, array('integer', 'integer'), array($this->activeId, 0)); $row = $this->db->fetchAssoc($res); if ($row['cnt'] > 0) { $this->db->update('tst_sequence', array('sequence' => array('clob', $tracking), 'postponed' => array('text', $postponed), 'hidden' => array('text', $hidden), 'tstamp' => array('integer', time())), array('active_fi' => array('integer', $this->activeId), 'pass' => array('integer', 0))); } else { $this->db->insert('tst_sequence', array('active_fi' => array('integer', $this->activeId), 'pass' => array('integer', 0), 'sequence' => array('clob', $tracking), 'postponed' => array('text', $postponed), 'hidden' => array('text', $hidden), 'tstamp' => array('integer', time()))); } }
/** * saves GENERIC feedback content for the given question id to the database. * Generic feedback is either feedback for the completed solution (all answers correct) * of the question or at least onen incorrect answer. * * @final * @access public * @param integer $questionId * @param boolean $solutionCompleted * @param string $feedbackContent * @return integer $feedbackId */ public final function saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent) { require_once 'Services/RTE/classes/class.ilRTE.php'; $correctness = $solutionCompleted ? 1 : 0; $feedbackId = $this->getGenericFeedbackId($questionId, $solutionCompleted); if (strlen($feedbackContent)) { $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0); } if ($feedbackId) { $this->db->update($this->getGenericFeedbackTableName(), array('feedback' => array('clob', $feedbackContent), 'tstamp' => array('integer', time())), array('feedback_id' => array('integer', $feedbackId))); } else { $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName()); $this->db->insert($this->getGenericFeedbackTableName(), array('feedback_id' => array('integer', $feedbackId), 'question_fi' => array('integer', $questionId), 'correctness' => array('text', $correctness), 'feedback' => array('clob', $feedbackContent), 'tstamp' => array('integer', time()))); } return $feedbackId; }
/** * Delete object by removing all database entries. * Deletion is only possible if this type is not assigned to any OrgUnit and if no plugin disallowed deletion process. * * @throws ilOrgUnitTypeException */ public function delete() { $orgus = $this->getOrgUnits(false); if (count($orgus)) { $titles = array(); /** @var $orgu ilObjOrgUnit */ foreach ($orgus as $orgu) { $titles[] = $orgu->getTitle(); } throw new ilOrgUnitTypeException(sprintf($this->lng->txt('orgu_type_msg_unable_delete'), implode(', ', $titles))); } $disallowed = array(); $titles = array(); /** @var ilOrgUnitTypeHookPlugin $plugin */ foreach ($this->getActivePlugins() as $plugin) { if (!$plugin->allowDelete($this->getId())) { $disallowed[] = $plugin; $titles[] = $plugin->getPluginName(); } } if (count($disallowed)) { $msg = sprintf($this->lng->txt('orgu_type_msg_deletion_prevented'), implode(', ', $titles)); throw new ilOrgUnitTypePluginException($msg, $disallowed); } $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE id = ' . $this->db->quote($this->getId(), 'integer'); $this->db->manipulate($sql); // Reset Type of OrgUnits (in Trash) $this->db->update('orgu_data', array('orgu_type_id' => array('integer', 0)), array('orgu_type_id' => array('integer', $this->getId()))); // Delete all translations ilOrgUnitTypeTranslation::deleteAllTranslations($this->getId()); // Delete icon & folder if (is_file($this->getIconPath(true))) { unlink($this->getIconPath(true)); } if (is_dir($this->getIconPath())) { rmdir($this->getIconPath()); } // Delete relations to advanced metadata records $sql = 'DELETE FROM orgu_types_adv_md_rec WHERE type_id = ' . $this->db->quote($this->getId(), 'integer'); $this->db->manipulate($sql); }
/** * @param $testId */ private function updateDbRecord($testId) { $this->db->update('tst_rnd_quest_set_qpls', array('test_fi' => array('integer', $testId), 'pool_fi' => array('integer', $this->getPoolId()), 'pool_title' => array('text', $this->getPoolTitle()), 'pool_path' => array('text', $this->getPoolPath()), 'pool_quest_count' => array('integer', $this->getPoolQuestionCount()), 'origin_tax_fi' => array('integer', $this->getOriginalFilterTaxId()), 'origin_node_fi' => array('integer', $this->getOriginalFilterTaxNodeId()), 'mapped_tax_fi' => array('integer', $this->getMappedFilterTaxId()), 'mapped_node_fi' => array('integer', $this->getMappedFilterTaxNodeId()), 'quest_amount' => array('integer', $this->getQuestionAmount()), 'sequence_pos' => array('integer', $this->getSequencePosition())), array('def_id' => array('integer', $this->getId()))); }
/** * Update a (member,value) pair in database * * @param $member * @param $value */ protected function updateMember($member, $value) { $this->db->update(self::TABLE_NAME, array('value' => array('text', $value)), array('orgu_type_id' => array('integer', $this->getOrguTypeId()), 'lang' => array('text', $this->getLang()), 'member' => array('text', $member))); }