00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 require_once "./assessment/classes/class.assQuestion.php";
00024 require_once "./assessment/classes/class.ilQTIUtils.php";
00025
00026 define("TEXT_QUESTION_IDENTIFIER", "TEXT QUESTION");
00027
00038 class ASS_TextQuestion extends ASS_Question
00039 {
00047 var $question;
00048
00056 var $maxNumOfChars;
00057
00071 function ASS_TextQuestion(
00072 $title = "",
00073 $comment = "",
00074 $author = "",
00075 $owner = -1,
00076 $question = ""
00077 )
00078 {
00079 $this->ASS_Question($title, $comment, $author, $owner);
00080 $this->question = $question;
00081 $this->maxNumOfChars = 0;
00082 $this->points = 0;
00083 }
00084
00093 function isComplete()
00094 {
00095 if (($this->title) and ($this->author) and ($this->question))
00096 {
00097 return true;
00098 }
00099 else
00100 {
00101 return false;
00102 }
00103 }
00104
00114 function from_xml($xml_text)
00115 {
00116 $result = false;
00117 if (!empty($this->domxml))
00118 {
00119 $this->domxml->free();
00120 }
00121 $xml_text = preg_replace("/>\s*?</", "><", $xml_text);
00122 $this->domxml = domxml_open_mem($xml_text);
00123 if (!empty($this->domxml))
00124 {
00125 $root = $this->domxml->document_element();
00126 $item = $root->first_child();
00127 $this->setTitle($item->get_attribute("title"));
00128 $this->gaps = array();
00129 $itemnodes = $item->child_nodes();
00130 foreach ($itemnodes as $index => $node)
00131 {
00132 switch ($node->node_name())
00133 {
00134 case "qticomment":
00135 $comment = $node->get_content();
00136 if (strpos($comment, "ILIAS Version=") !== false)
00137 {
00138 }
00139 elseif (strpos($comment, "Questiontype=") !== false)
00140 {
00141 }
00142 elseif (strpos($comment, "Author=") !== false)
00143 {
00144 $comment = str_replace("Author=", "", $comment);
00145 $this->setAuthor($comment);
00146 }
00147 else
00148 {
00149 $this->setComment($comment);
00150 }
00151 break;
00152 case "itemmetadata":
00153 $md_array = array();
00154 $metanodes = $node->child_nodes();
00155 foreach ($metanodes as $metanode)
00156 {
00157 switch ($metanode->node_name())
00158 {
00159 case "qtimetadata":
00160 $metafields = $metanode->child_nodes();
00161 foreach ($metafields as $metafield)
00162 {
00163 switch ($metafield->node_name())
00164 {
00165 case "qtimetadatafield":
00166 $metafieldlist = $metafield->child_nodes();
00167 $md = array("label" => "", "entry" => "");
00168 foreach ($metafieldlist as $attr)
00169 {
00170 switch ($attr->node_name())
00171 {
00172 case "fieldlabel":
00173 $md["label"] = $attr->get_content();
00174 break;
00175 case "fieldentry":
00176 $md["entry"] = $attr->get_content();
00177 break;
00178 }
00179 }
00180 array_push($md_array, $md);
00181 break;
00182 }
00183 }
00184 break;
00185 }
00186 }
00187 foreach ($md_array as $md)
00188 {
00189 switch ($md["label"])
00190 {
00191 case "ILIAS_VERSION":
00192 break;
00193 case "QUESTIONTYPE":
00194 break;
00195 case "AUTHOR":
00196 $this->setAuthor($md["entry"]);
00197 break;
00198 }
00199 }
00200 break;
00201 case "duration":
00202 $iso8601period = $node->get_content();
00203 if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
00204 {
00205 $this->setEstimatedWorkingTime($matches[4], $matches[5], $matches[6]);
00206 }
00207 break;
00208 case "presentation":
00209 $flow = $node->first_child();
00210 $flownodes = $flow->child_nodes();
00211 foreach ($flownodes as $idx => $flownode)
00212 {
00213 if (strcmp($flownode->node_name(), "material") == 0)
00214 {
00215 $mattext = $flownode->first_child();
00216 $this->set_question($mattext->get_content());
00217 }
00218 elseif (strcmp($flownode->node_name(), "response_str") == 0)
00219 {
00220 $subnodes = $flownode->child_nodes();
00221 foreach ($subnodes as $node_type)
00222 {
00223 switch ($node_type->node_name())
00224 {
00225 case "render_fib":
00226 $render_choice = $node_type;
00227 if (strcmp($render_choice->node_name(), "render_fib") == 0)
00228 {
00229
00230 $maxchars = $render_choice->get_attribute("maxchars");
00231 $this->setMaxNumOfChars($maxchars);
00232 }
00233 break;
00234 case "material":
00235 $matlabel = $node_type->get_attribute("label");
00236 if (strcmp($matlabel, "suggested_solution") == 0)
00237 {
00238 $mattype = $node_type->first_child();
00239 if (strcmp($mattype->node_name(), "mattext") == 0)
00240 {
00241 $suggested_solution = $mattype->get_content();
00242 if ($suggested_solution)
00243 {
00244 if ($this->getId() < 1)
00245 {
00246 $this->saveToDb();
00247 }
00248 $this->setSuggestedSolution($suggested_solution, 0, true);
00249 }
00250 }
00251 }
00252 break;
00253 }
00254 }
00255 }
00256 }
00257 break;
00258 case "resprocessing":
00259 $resproc_nodes = $node->child_nodes();
00260 foreach ($resproc_nodes as $index => $respcondition)
00261 {
00262 if (strcmp($respcondition->node_name(), "outcomes") == 0)
00263 {
00264 $outcomes_nodes = $respcondition->child_nodes();
00265 foreach ($outcomes_nodes as $oidx => $decvar)
00266 {
00267 if (strcmp($decvar->node_name(), "decvar") == 0)
00268 {
00269 $maxpoints = $decvar->get_attribute("maxvalue");
00270 $this->setPoints($maxpoints);
00271 }
00272 }
00273 }
00274 }
00275 break;
00276 }
00277 }
00278 $result = true;
00279 }
00280 return $result;
00281 }
00282
00292 function to_xml($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false)
00293 {
00294 if (!empty($this->domxml))
00295 {
00296 $this->domxml->free();
00297 }
00298 $xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
00299 $xml_header .= "<questestinterop></questestinterop>\n";
00300 $this->domxml = domxml_open_mem($xml_header);
00301 $root = $this->domxml->document_element();
00302
00303 $qtiIdent = $this->domxml->create_element("item");
00304 $qtiIdent->set_attribute("ident", "il_".IL_INST_ID."_qst_".$this->getId());
00305 $qtiIdent->set_attribute("title", $this->getTitle());
00306 $root->append_child($qtiIdent);
00307
00308 $qtiComment = $this->domxml->create_element("qticomment");
00309 $qtiCommentText = $this->domxml->create_text_node($this->getComment());
00310 $qtiComment->append_child($qtiCommentText);
00311 $qtiIdent->append_child($qtiComment);
00312
00313 $qtiDuration = $this->domxml->create_element("duration");
00314 $workingtime = $this->getEstimatedWorkingTime();
00315 $qtiDurationText = $this->domxml->create_text_node(sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]));
00316 $qtiDuration->append_child($qtiDurationText);
00317 $qtiIdent->append_child($qtiDuration);
00318
00319 $qtiItemmetadata = $this->domxml->create_element("itemmetadata");
00320 $qtiMetadata = $this->domxml->create_element("qtimetadata");
00321
00322 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00323 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00324 $qtiFieldlabelText = $this->domxml->create_text_node("ILIAS_VERSION");
00325 $qtiFieldlabel->append_child($qtiFieldlabelText);
00326 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00327 $qtiFieldentryText = $this->domxml->create_text_node($this->ilias->getSetting("ilias_version"));
00328 $qtiFieldentry->append_child($qtiFieldentryText);
00329 $qtiMetadatafield->append_child($qtiFieldlabel);
00330 $qtiMetadatafield->append_child($qtiFieldentry);
00331 $qtiMetadata->append_child($qtiMetadatafield);
00332
00333 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00334 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00335 $qtiFieldlabelText = $this->domxml->create_text_node("QUESTIONTYPE");
00336 $qtiFieldlabel->append_child($qtiFieldlabelText);
00337 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00338 $qtiFieldentryText = $this->domxml->create_text_node(TEXT_QUESTION_IDENTIFIER);
00339 $qtiFieldentry->append_child($qtiFieldentryText);
00340 $qtiMetadatafield->append_child($qtiFieldlabel);
00341 $qtiMetadatafield->append_child($qtiFieldentry);
00342 $qtiMetadata->append_child($qtiMetadatafield);
00343
00344 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00345 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00346 $qtiFieldlabelText = $this->domxml->create_text_node("AUTHOR");
00347 $qtiFieldlabel->append_child($qtiFieldlabelText);
00348 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00349 $qtiFieldentryText = $this->domxml->create_text_node($this->getAuthor());
00350 $qtiFieldentry->append_child($qtiFieldentryText);
00351 $qtiMetadatafield->append_child($qtiFieldlabel);
00352 $qtiMetadatafield->append_child($qtiFieldentry);
00353 $qtiMetadata->append_child($qtiMetadatafield);
00354
00355 $qtiItemmetadata->append_child($qtiMetadata);
00356 $qtiIdent->append_child($qtiItemmetadata);
00357
00358
00359 $qtiPresentation = $this->domxml->create_element("presentation");
00360 $qtiPresentation->set_attribute("label", $this->getTitle());
00361
00362 $qtiFlow = $this->domxml->create_element("flow");
00363
00364 $qtiMaterial = $this->domxml->create_element("material");
00365 $qtiMatText = $this->domxml->create_element("mattext");
00366 $qtiMatTextText = $this->domxml->create_text_node($this->get_question());
00367 $qtiMatText->append_child($qtiMatTextText);
00368 $qtiMaterial->append_child($qtiMatText);
00369 $qtiFlow->append_child($qtiMaterial);
00370
00371 $qtiResponseStr = $this->domxml->create_element("response_str");
00372 $qtiResponseStr->set_attribute("ident", "TEXT");
00373 $qtiResponseStr->set_attribute("rcardinality", "Ordered");
00374 $qtiRenderFib = $this->domxml->create_element("render_fib");
00375 $qtiRenderFib->set_attribute("fibtype", "String");
00376 $qtiRenderFib->set_attribute("prompt", "Box");
00377 $qtiResponseLabel = $this->domxml->create_element("response_label");
00378 $qtiResponseLabel->set_attribute("ident", "A");
00379 $qtiRenderFib->append_child($qtiResponseLabel);
00380 $qtiResponseStr->append_child($qtiRenderFib);
00381 if ($this->getMaxNumOfChars() > 0)
00382 {
00383 $qtiRenderFib->set_attribute("maxchars", $this->getMaxNumOfChars());
00384 }
00385 $solution = $this->getSuggestedSolution(0);
00386 if (count($solution))
00387 {
00388 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches))
00389 {
00390 $qtiMaterial = $this->domxml->create_element("material");
00391 $qtiMaterial->set_attribute("label", "suggested_solution");
00392 $qtiMatText = $this->domxml->create_element("mattext");
00393 $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
00394 if (strcmp($matches[1], "") != 0)
00395 {
00396 $intlink = $solution["internal_link"];
00397 }
00398 $qtiMatTextText = $this->domxml->create_text_node($intlink);
00399 $qtiMatText->append_child($qtiMatTextText);
00400 $qtiMaterial->append_child($qtiMatText);
00401 $qtiResponseStr->append_child($qtiMaterial);
00402 }
00403 }
00404 $qtiFlow->append_child($qtiResponseStr);
00405 $qtiPresentation->append_child($qtiFlow);
00406 $qtiIdent->append_child($qtiPresentation);
00407
00408 $qtiResprocessing = $this->domxml->create_element("resprocessing");
00409 $qtiResprocessing->set_attribute("scoremodel", "HumanRater");
00410 $qtiOutcomes = $this->domxml->create_element("outcomes");
00411 $qtiDecvar = $this->domxml->create_element("decvar");
00412 $qtiDecvar->set_attribute("varname", "WritingScore");
00413 $qtiDecvar->set_attribute("vartype", "Integer");
00414 $qtiDecvar->set_attribute("minvalue", "0");
00415 $qtiDecvar->set_attribute("maxvalue", $this->getPoints());
00416 $qtiOutcomes->append_child($qtiDecvar);
00417 $qtiResprocessing->append_child($qtiOutcomes);
00418
00419 $qtiOther = $this->domxml->create_element("other");
00420 $qtiOtherText = $this->domxml->create_text_node("tutor rated");
00421 $qtiOther->append_child($qtiOtherText);
00422 $qtiConditionVar = $this->domxml->create_element("conditionvar");
00423 $qtiConditionVar->append_child($qtiOther);
00424 $qtiRespCondition = $this->domxml->create_element("respcondition");
00425 $qtiRespCondition->append_child($qtiConditionVar);
00426 $qtiResprocessing->append_child($qtiRespCondition);
00427
00428 $qtiIdent->append_child($qtiResprocessing);
00429
00430 $xml = $this->domxml->dump_mem(true);
00431 if (!$a_include_header)
00432 {
00433 $pos = strpos($xml, "?>");
00434 $xml = substr($xml, $pos + 2);
00435 }
00436 return $xml;
00437 }
00438
00447 function saveToDb($original_id = "")
00448 {
00449 global $ilias;
00450
00451 $complete = 0;
00452 if ($this->isComplete())
00453 {
00454 $complete = 1;
00455 }
00456 $db = & $ilias->db;
00457
00458 $estw_time = $this->getEstimatedWorkingTime();
00459 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
00460
00461 if ($original_id)
00462 {
00463 $original_id = $db->quote($original_id);
00464 }
00465 else
00466 {
00467 $original_id = "NULL";
00468 }
00469
00470 if ($this->id == -1)
00471 {
00472
00473 $now = getdate();
00474 $question_type = $this->getQuestionType();
00475 $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
00476 $query = sprintf("INSERT INTO qpl_questions (question_id, question_type_fi, obj_fi, title, comment, author, owner, points, question_text, working_time, maxNumOfChars, complete, created, original_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
00477 $db->quote($question_type),
00478 $db->quote($this->obj_id),
00479 $db->quote($this->title),
00480 $db->quote($this->comment),
00481 $db->quote($this->author),
00482 $db->quote($this->owner),
00483 $db->quote($this->getPoints() . ""),
00484 $db->quote($this->question),
00485 $db->quote($estw_time),
00486 $db->quote($this->getMaxNumOfChars()),
00487 $db->quote("$complete"),
00488 $db->quote($created),
00489 $original_id
00490 );
00491 $result = $db->query($query);
00492
00493 if ($result == DB_OK)
00494 {
00495 $this->id = $this->ilias->db->getLastInsertId();
00496
00497
00498 $this->createPageObject();
00499
00500
00501 if ($this->getTestId() > 0)
00502 {
00503 $this->insertIntoTest($this->getTestId());
00504 }
00505 }
00506 }
00507 else
00508 {
00509
00510 $query = sprintf("UPDATE qpl_questions SET obj_fi = %s, title = %s, comment = %s, author = %s, points = %s, question_text = %s, working_time=%s, maxNumOfChars = %s, complete = %s WHERE question_id = %s",
00511 $db->quote($this->obj_id. ""),
00512 $db->quote($this->title),
00513 $db->quote($this->comment),
00514 $db->quote($this->author),
00515 $db->quote($this->getPoints() . ""),
00516 $db->quote($this->question),
00517 $db->quote($estw_time),
00518 $db->quote($this->getMaxNumOfChars()),
00519 $db->quote("$complete"),
00520 $db->quote($this->id)
00521 );
00522 $result = $db->query($query);
00523 }
00524 parent::saveToDb($original_id);
00525 }
00526
00536 function loadFromDb($question_id)
00537 {
00538 global $ilias;
00539
00540 $db = & $ilias->db;
00541 $query = sprintf("SELECT * FROM qpl_questions WHERE question_id = %s",
00542 $db->quote($question_id));
00543 $result = $db->query($query);
00544 if (strcmp(strtolower(get_class($result)), db_result) == 0)
00545 {
00546 if ($result->numRows() == 1)
00547 {
00548 $data = $result->fetchRow(DB_FETCHMODE_OBJECT);
00549 $this->id = $question_id;
00550 $this->title = $data->title;
00551 $this->comment = $data->comment;
00552 $this->solution_hint = $data->solution_hint;
00553 $this->original_id = $data->original_id;
00554 $this->obj_id = $data->obj_fi;
00555 $this->author = $data->author;
00556 $this->owner = $data->owner;
00557 $this->question = $data->question_text;
00558 $this->maxNumOfChars = $data->maxNumOfChars;
00559 $this->points = $data->points;
00560 $this->setEstimatedWorkingTime(substr($data->working_time, 0, 2), substr($data->working_time, 3, 2), substr($data->working_time, 6, 2));
00561 }
00562 }
00563 parent::loadFromDb($question_id);
00564 }
00565
00573 function duplicate($for_test = true, $title = "", $author = "", $owner = "")
00574 {
00575 if ($this->id <= 0)
00576 {
00577
00578 return;
00579 }
00580
00581 $clone = $this;
00582 include_once ("./assessment/classes/class.assQuestion.php");
00583 $original_id = ASS_Question::_getOriginalId($this->id);
00584 $clone->id = -1;
00585 if ($title)
00586 {
00587 $clone->setTitle($title);
00588 }
00589
00590 if ($author)
00591 {
00592 $clone->setAuthor($author);
00593 }
00594 if ($owner)
00595 {
00596 $clone->setOwner($owner);
00597 }
00598
00599 if ($for_test)
00600 {
00601 $clone->saveToDb($original_id);
00602 }
00603 else
00604 {
00605 $clone->saveToDb();
00606 }
00607
00608
00609 $clone->copyPageOfQuestion($original_id);
00610
00611 return $clone->id;
00612 }
00613
00623 function get_question()
00624 {
00625 return $this->question;
00626 }
00627
00637 function set_question($question = "")
00638 {
00639 $this->question = $question;
00640 }
00641
00651 function getMaxNumOfChars()
00652 {
00653 if (strcmp($this->maxNumOfChars, "") == 0)
00654 {
00655 return 0;
00656 }
00657 else
00658 {
00659 return $this->maxNumOfChars;
00660 }
00661 }
00662
00672 function setMaxNumOfChars($maxchars = 0)
00673 {
00674 $this->maxNumOfChars = $maxchars;
00675 }
00676
00685 function getMaximumPoints()
00686 {
00687 return $this->points;
00688 }
00689
00701 function setReachedPoints($user_id, $test_id, $points)
00702 {
00703 if (($points > 0) && ($points <= $this->getPoints()))
00704 {
00705 $query = sprintf("UPDATE tst_test_result SET points = %s WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00706 $this->ilias->db->quote($points . ""),
00707 $this->ilias->db->quote($user_id . ""),
00708 $this->ilias->db->quote($test_id . ""),
00709 $this->ilias->db->quote($this->getId() . "")
00710 );
00711 $result = $this->ilias->db->query($query);
00712 return true;
00713 }
00714 else
00715 {
00716 return false;
00717 }
00718 }
00719
00732 function _setReachedPoints($user_id, $test_id, $question_id, $points, $maxpoints)
00733 {
00734 global $ilDB;
00735
00736 if (($points > 0) && ($points <= $maxpoints))
00737 {
00738 $query = sprintf("UPDATE tst_test_result SET points = %s WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00739 $ilDB->quote($points . ""),
00740 $ilDB->quote($user_id . ""),
00741 $ilDB->quote($test_id . ""),
00742 $ilDB->quote($question_id . "")
00743 );
00744 $result = $this->ilias->db->query($query);
00745
00746
00747 include_once 'course/classes/class.ilCourseObjectiveResult.php';
00748
00749 ilCourseObjectiveResult::_updateUserResult($user_id,$question_id,$points);
00750
00751
00752 return true;
00753 }
00754 else
00755 {
00756 return false;
00757 }
00758 }
00759
00771 function calculateReachedPoints($user_id, $test_id)
00772 {
00773 global $ilDB;
00774
00775 $points = 0;
00776 $query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00777 $this->ilias->db->quote($user_id),
00778 $this->ilias->db->quote($test_id),
00779 $this->ilias->db->quote($this->getId())
00780 );
00781 $result = $this->ilias->db->query($query);
00782 if ($result->numRows() == 1)
00783 {
00784 $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
00785 if ($row["points"])
00786 {
00787 $points = $row["points"];
00788 }
00789 }
00790
00791
00792 $query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
00793 $ilDB->quote($test_id)
00794 );
00795 $result = $ilDB->query($query);
00796 if ($result->numRows() == 1)
00797 {
00798 $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
00799 if ($row["count_system"] == 1)
00800 {
00801 if ($points != $this->getMaximumPoints())
00802 {
00803 $points = 0;
00804 }
00805 }
00806 }
00807 else
00808 {
00809 $points = 0;
00810 }
00811 return $points;
00812 }
00813
00823 function getReachedInformation($user_id, $test_id)
00824 {
00825 $found_values = array();
00826 $query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00827 $this->ilias->db->quote($user_id),
00828 $this->ilias->db->quote($test_id),
00829 $this->ilias->db->quote($this->getId())
00830 );
00831 $result = $this->ilias->db->query($query);
00832 $user_result = array();
00833 while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT))
00834 {
00835 $user_result = array(
00836 "value" => $data->value1
00837 );
00838 }
00839 return $user_result;
00840 }
00841
00852 function saveWorkingData($test_id, $limit_to = LIMIT_NO_LIMIT)
00853 {
00854 global $ilDB;
00855 global $ilUser;
00856
00857 $db =& $ilDB->db;
00858
00859 $query = sprintf("DELETE FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00860 $db->quote($ilUser->id),
00861 $db->quote($test_id),
00862 $db->quote($this->getId())
00863 );
00864 $result = $db->query($query);
00865
00866 $text = ilUtil::stripSlashes($_POST["TEXT"]);
00867 if ($this->getMaxNumOfChars())
00868 {
00869 $text = substr($text, 0, $this->getMaxNumOfChars());
00870 }
00871 $query = sprintf("INSERT INTO tst_solutions (solution_id, user_fi, test_fi, question_fi, value1, value2, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL, NULL)",
00872 $db->quote($ilUser->id),
00873 $db->quote($test_id),
00874 $db->quote($this->getId()),
00875 $db->quote($text)
00876 );
00877 $result = $db->query($query);
00878 parent::saveWorkingData($test_id);
00879 return true;
00880 }
00881
00882 function syncWithOriginal()
00883 {
00884 global $ilias;
00885 if ($this->original_id)
00886 {
00887 $complete = 0;
00888 if ($this->isComplete())
00889 {
00890 $complete = 1;
00891 }
00892 $db = & $ilias->db;
00893
00894 $estw_time = $this->getEstimatedWorkingTime();
00895 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
00896
00897 $query = sprintf("UPDATE qpl_questions SET obj_fi = %s, title = %s, comment = %s, author = %s, question_text = %s, working_time=%s, maxNumOfChars = %s, complete = %s WHERE question_id = %s",
00898 $db->quote($this->obj_id. ""),
00899 $db->quote($this->title. ""),
00900 $db->quote($this->comment. ""),
00901 $db->quote($this->author. ""),
00902 $db->quote($this->question. ""),
00903 $db->quote($estw_time. ""),
00904 $db->quote($this->maxNumOfChars. ""),
00905 $db->quote($complete. ""),
00906 $db->quote($this->original_id. "")
00907 );
00908 $result = $db->query($query);
00909
00910 parent::syncWithOriginal();
00911 }
00912 }
00913
00914 function createRandomSolution($test_id, $user_id)
00915 {
00916 }
00917
00926 function getQuestionType()
00927 {
00928 return 8;
00929 }
00930 }
00931
00932 ?>