本文整理汇总了PHP中assQuestion::loadFromDb方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::loadFromDb方法的具体用法?PHP assQuestion::loadFromDb怎么用?PHP assQuestion::loadFromDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::loadFromDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromDb
/**
* Loads a assSingleChoice object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$hasimages = 0;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$shuffle = is_null($data['shuffle']) ? true : $data['shuffle'];
$this->setShuffle($shuffle);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
$this->setThumbSize($data['thumb_size']);
$this->isSingleline = $data['allow_images'] ? false : true;
$this->lastChange = $data['tstamp'];
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
}
$result = $ilDB->queryF("SELECT * FROM qpl_a_sc WHERE question_fi = %s ORDER BY aorder ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$imagefilename = $this->getImagePath() . $data["imagefile"];
if (!@file_exists($imagefilename)) {
$data["imagefile"] = "";
}
include_once "./Services/RTE/classes/class.ilRTE.php";
$data["answertext"] = ilRTE::_replaceMediaObjectImageSrc($data["answertext"], 1);
array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"], 1, $data["imagefile"]));
}
}
parent::loadFromDb($question_id);
}
示例2: loadFromDb
/**
* Loads a assClozeTest object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the cloze test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setNrOfTries($data['nr_of_tries']);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
$this->setQuestion($this->cleanQuestiontext($data["question_text"]));
$this->setFixedTextLength($data["fixed_textlen"]);
$this->setIdenticalScoring($data['tstamp'] == 0 ? true : $data["identical_scoring"]);
// replacement of old syntax with new syntax
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->question = ilRTE::_replaceMediaObjectImageSrc($this->question, 1);
$this->setTextgapRating($data["textgap_rating"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
// open the cloze gaps with all answers
include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
include_once "./Modules/TestQuestionPool/classes/class.assClozeGap.php";
$result = $ilDB->queryF("SELECT * FROM qpl_a_cloze WHERE question_fi = %s ORDER BY gap_id, aorder ASC", array("integer"), array($question_id));
if ($result->numRows() > 0) {
$this->gaps = array();
while ($data = $ilDB->fetchAssoc($result)) {
switch ($data["cloze_type"]) {
case CLOZE_TEXT:
if (!array_key_exists($data["gap_id"], $this->gaps)) {
$this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_TEXT);
}
$answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
$this->gaps[$data["gap_id"]]->addItem($answer);
break;
case CLOZE_SELECT:
if (!array_key_exists($data["gap_id"], $this->gaps)) {
$this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_SELECT);
$this->gaps[$data["gap_id"]]->setShuffle($data["shuffle"]);
}
$answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
$this->gaps[$data["gap_id"]]->addItem($answer);
break;
case CLOZE_NUMERIC:
if (!array_key_exists($data["gap_id"], $this->gaps)) {
$this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_NUMERIC);
}
$answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
$answer->setLowerBound($data["lowerlimit"]);
$answer->setUpperBound($data["upperlimit"]);
$this->gaps[$data["gap_id"]]->addItem($answer);
break;
}
}
}
}
parent::loadFromDb($question_id);
}
示例3: loadFromDb
/**
* Loads a assJavaApplet object from a database
*
* Loads a assJavaApplet object from a database (experimental)
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setJavaAppletFilename($data["image_file"]);
$this->splitParams($data["params"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
}
parent::loadFromDb($question_id);
}
示例4: loadFromDb
public function loadFromDb($questionId)
{
$res = $this->db->queryF($this->buildQuestionDataQuery(), array('integer'), array($questionId));
while ($data = $this->db->fetchAssoc($res)) {
$this->setId($questionId);
$this->setOriginalId($data['original_id']);
$this->setObjId($data['obj_fi']);
$this->setTitle($data['title']);
$this->setNrOfTries($data['nr_of_tries']);
$this->setComment($data['description']);
$this->setAuthor($data['author']);
$this->setPoints($data['points']);
$this->setOwner($data['owner']);
$this->setEstimatedWorkingTimeFromDurationString($data['working_time']);
$this->setLastChange($data['tstamp']);
require_once 'Services/RTE/classes/class.ilRTE.php';
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data['question_text'], 1));
$this->setShuffleAnswersEnabled((bool) $data['shuffle_answers']);
if ($this->isValidAnswerType($data['answer_type'])) {
$this->setAnswerType($data['answer_type']);
}
if (is_numeric($data['thumb_size'])) {
$this->setThumbSize((int) $data['thumb_size']);
}
if ($this->isValidOptionLabel($data['opt_label'])) {
$this->setOptionLabel($data['opt_label']);
}
$this->setCustomTrueOptionLabel($data['custom_true']);
$this->setCustomFalseOptionLabel($data['custom_false']);
if ($data['score_partsol'] !== null) {
$this->setScorePartialSolutionEnabled((bool) $data['score_partsol']);
}
if (isset($data['feedback_setting'])) {
$this->setSpecificFeedbackSetting((int) $data['feedback_setting']);
}
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
}
$this->loadAnswerData($questionId);
parent::loadFromDb($questionId);
}
示例5: loadFromDb
/**
* Loads a assFormulaQuestion object from a database
* @param integer $question_id A unique key which defines the question in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.* FROM qpl_questions WHERE question_id = %s", array('integer'), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setSuggestedSolution($data["solution_hint"]);
$this->setOriginalId($data["original_id"]);
$this->setObjId($data["obj_fi"]);
$this->setAuthor($data["author"]);
$this->setOwner($data["owner"]);
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
$this->unitrepository = new ilUnitConfigurationRepository($question_id);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
// load variables
$result = $ilDB->queryF("SELECT * FROM il_qpl_qst_fq_var WHERE question_fi = %s", array('integer'), array($question_id));
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$varObj = new assFormulaQuestionVariable($data["variable"], $data["range_min"], $data["range_max"], $this->getUnitrepository()->getUnit($data["unit_fi"]), $data["varprecision"], $data["intprecision"]);
$varObj->setRangeMinTxt($data['range_min_txt']);
$varObj->setRangeMaxTxt($data['range_max_txt']);
$this->addVariable($varObj);
}
}
// load results
$result = $ilDB->queryF("SELECT * FROM il_qpl_qst_fq_res WHERE question_fi = %s", array('integer'), array($question_id));
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$resObj = new assFormulaQuestionResult($data["result"], $data["range_min"], $data["range_max"], $data["tolerance"], $this->getUnitrepository()->getUnit($data["unit_fi"]), $data["formula"], $data["points"], $data["resprecision"], $data["rating_simple"], $data["rating_sign"], $data["rating_value"], $data["rating_unit"]);
$resObj->setResultType($data['result_type']);
$resObj->setRangeMinTxt($data['range_min_txt']);
$resObj->setRangeMaxTxt($data['range_max_txt']);
$this->addResult($resObj);
}
}
// load result units
$result = $ilDB->queryF("SELECT * FROM il_qpl_qst_fq_res_unit WHERE question_fi = %s", array('integer'), array($question_id));
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$unit = $this->getUnitrepository()->getUnit($data["unit_fi"]);
$resObj = $this->getResult($data["result"]);
$this->addResultUnit($resObj, $unit);
}
}
}
parent::loadFromDb($question_id);
}
示例6: loadFromDb
/**
* Loads a assMatchingQuestion object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setThumbGeometry($data["thumb_geometry"]);
$this->setElementHeight($data["element_height"]);
$this->setShuffle($data["shuffle"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
}
$termids = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
$this->terms = array();
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$term = new assAnswerMatchingTerm($data['term'], $data['picture'], $data['term_id']);
array_push($this->terms, $term);
$termids[$data['term_id']] = $term;
}
}
$definitionids = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
$this->definitions = array();
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$definition = new assAnswerMatchingDefinition($data['definition'], $data['picture'], $data['morder']);
array_push($this->definitions, $definition);
$definitionids[$data['def_id']] = $definition;
}
}
$this->matchingpairs = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
array_push($this->matchingpairs, new assAnswerMatchingPair($termids[$data['term_fi']], $definitionids[$data['definition_fi']], $data['points']));
}
}
parent::loadFromDb($question_id);
}
示例7: loadFromDb
/**
* Loads a assNumeric object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setMaxChars($data["maxnumofchars"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
}
$result = $ilDB->queryF("SELECT * FROM qpl_num_range WHERE question_fi = %s ORDER BY aorder ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assNumericRange.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$this->setPoints($data['points']);
$this->setLowerLimit($data['lowerlimit']);
$this->setUpperLimit($data['upperlimit']);
}
}
parent::loadFromDb($question_id);
}
示例8: loadFromDb
/**
* Loads a assFlashQuestion object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setNrOfTries($data['nr_of_tries']);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setSuggestedSolution($data["solution_hint"]);
$this->setOriginalId($data["original_id"]);
$this->setObjId($data["obj_fi"]);
$this->setAuthor($data["author"]);
$this->setOwner($data["owner"]);
$this->setPoints($data["points"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
// load additional data
$result = $ilDB->queryF("SELECT * FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setWidth($data["width"]);
$this->setHeight($data["height"]);
$this->setApplet($data["applet"]);
$this->parameters = unserialize($data["params"]);
if (!is_array($this->parameters)) {
$this->clearParameters();
}
unset($_SESSION["flash_upload_filename"]);
}
}
parent::loadFromDb($question_id);
}
示例9: loadFromDb
/**
* Loads a assOrderingQuestion object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
$this->thumb_geometry = $data["thumb_geometry"];
$this->element_height = $data["element_height"];
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
}
$result = $ilDB->queryF("SELECT * FROM qpl_a_ordering WHERE question_fi = %s ORDER BY solution_order ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
include_once "./Services/RTE/classes/class.ilRTE.php";
$data["answertext"] = ilRTE::_replaceMediaObjectImageSrc($data["answertext"], 1);
array_push($this->answers, new ASS_AnswerOrdering($data["answertext"], $data["random_id"]));
}
}
parent::loadFromDb($question_id);
}
示例10: loadFromDb
/**
* Loads a SyntaxTree object from a database
*
* Loads a SyntaxTree object from a database (experimental)
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.*, il_qpl_qst_st_quest.* FROM qpl_questions, il_qpl_qst_st_quest WHERE question_id = %s AND qpl_questions.question_id = il_qpl_qst_st_quest.question_fi", $ilDB->quote($question_id));
$result = $ilDB->query($query);
if ($result->numRows() == 1) {
$data = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
$this->id = $question_id;
$this->title = $data->title;
$this->comment = $data->description;
$this->solution_hint = $data->solution_hint;
$this->original_id = $data->original_id;
$this->obj_id = $data->obj_fi;
$this->author = $data->author;
$this->owner = $data->owner;
$this->points = $data->points;
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->question = ilRTE::_replaceMediaObjectImageSrc($data->question_text, 1);
$this->correctanswers = $data->correctanswers;
$this->text_rating = $data->textgap_rating;
$this->setEstimatedWorkingTime(substr($data->working_time, 0, 2), substr($data->working_time, 3, 2), substr($data->working_time, 6, 2));
$query = sprintf("SELECT * FROM il_qpl_qst_st_answer WHERE question_fi = %s ORDER BY aorder ASC", $ilDB->quote($question_id));
$result = $ilDB->query($query);
include_once "./Modules/TestQuestionPool/classes/class.assAnswerSimple.php";
if ($result->numRows() > 0) {
while ($data = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) {
array_push($this->answers, new ASS_AnswerSimple($data["answertext"], $data["points"], $data["aorder"]));
}
}
}
parent::loadFromDb($question_id);
}
示例11: loadFromDb
/**
* Loads a assFileUpload object from a database
*
* @param integer $question_id A unique key which defines the question in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setSuggestedSolution($data["solution_hint"]);
$this->setOriginalId($data["original_id"]);
$this->setObjId($data["obj_fi"]);
$this->setAuthor($data["author"]);
$this->setOwner($data["owner"]);
$this->setPoints($data["points"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
$this->setMaxSize($data["maxsize"]);
$this->setAllowedExtensions($data["allowedextensions"]);
$this->setCompletionBySubmission($data['compl_by_submission'] == 1 ? true : false);
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
}
parent::loadFromDb($question_id);
}
示例12: loadFromDb
/**
* Loads an assAccountingQuestion object from a database
*
* @param integer $question_id A unique key which defines the question in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
// load the basic question data
$result = $ilDB->query("SELECT qpl_questions.* FROM qpl_questions WHERE question_id = " . $ilDB->quote($question_id, 'integer'));
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setSuggestedSolution($data["solution_hint"]);
$this->setOriginalId($data["original_id"]);
$this->setObjId($data["obj_fi"]);
$this->setAuthor($data["author"]);
$this->setOwner($data["owner"]);
$this->setPoints($data["points"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
// get the hash value for accounts definition
$result = $ilDB->query("SELECT h.data FROM il_qpl_qst_accqst_data d" . " INNER JOIN il_qpl_qst_accqst_hash h ON d.account_hash = h.hash" . " WHERE d.question_fi =" . $ilDB->quote($question_id, 'integer'));
$data = $ilDB->fetchAssoc($result);
$this->setAccountsXML($data["data"]);
// load the question parts
$this->loadParts();
// loads additional stuff like suggested solutions
parent::loadFromDb($question_id);
}
示例13: loadFromDb
/**
* Loads a assMatchingQuestion object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
$query = "\n\t\t\tSELECT\t\tqpl_questions.*,\n\t\t\t\t\t\t{$this->getAdditionalTableName()}.*\n\t\t\tFROM\t\tqpl_questions\n\t\t\tLEFT JOIN\t{$this->getAdditionalTableName()}\n\t\t\tON\t\t\t{$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id\n\t\t\tWHERE\t\tqpl_questions.question_id = %s\n\t\t";
$result = $ilDB->queryF($query, array('integer'), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setThumbGeometry($data["thumb_geometry"]);
$this->setShuffle($data["shuffle"]);
$this->setMatchingMode($data['matching_mode'] === null ? self::MATCHING_MODE_1_ON_1 : $data['matching_mode']);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
}
$termids = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
$this->terms = array();
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$term = new assAnswerMatchingTerm($data['term'], $data['picture'], $data['term_id']);
array_push($this->terms, $term);
$termids[$data['term_id']] = $term;
}
}
$definitionids = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
$this->definitions = array();
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
$definition = new assAnswerMatchingDefinition($data['definition'], $data['picture'], $data['morder']);
array_push($this->definitions, $definition);
$definitionids[$data['def_id']] = $definition;
}
}
$this->matchingpairs = array();
$result = $ilDB->queryF("SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
array_push($this->matchingpairs, new assAnswerMatchingPair($termids[$data['term_fi']], $definitionids[$data['definition_fi']], $data['points']));
}
}
parent::loadFromDb($question_id);
}
示例14: loadFromDb
/**
* Loads a assTextSubset object from a database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
* @access public
*/
function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setCorrectAnswers($data["correctanswers"]);
$this->setTextRating($data["textgap_rating"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
}
$result = $ilDB->queryF("SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]));
}
}
parent::loadFromDb($question_id);
}
示例15: loadFromDb
/**
* Loads the object from the database
*
* @param object $db A pear DB object
* @param integer $question_id A unique key which defines the multiple choice test in the database
*/
public function loadFromDb($question_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
if ($result->numRows() == 1) {
$data = $ilDB->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setTitle($data["title"]);
$this->setComment($data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setNrOfTries($data['nr_of_tries']);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setOwner($data["owner"]);
include_once "./Services/RTE/classes/class.ilRTE.php";
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
$this->setErrorText($data["errortext"]);
$this->setTextSize($data["textsize"]);
$this->setPointsWrong($data["points_wrong"]);
$this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
try {
$this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
} catch (ilTestQuestionPoolException $e) {
}
}
$result = $ilDB->queryF("SELECT * FROM qpl_a_errortext WHERE question_fi = %s ORDER BY sequence ASC", array('integer'), array($question_id));
include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
if ($result->numRows() > 0) {
while ($data = $ilDB->fetchAssoc($result)) {
array_push($this->errordata, new assAnswerErrorText($data["text_wrong"], $data["text_correct"], $data["points"]));
}
}
parent::loadFromDb($question_id);
}