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
00065 var $points;
00066
00080 function ASS_TextQuestion(
00081 $title = "",
00082 $comment = "",
00083 $author = "",
00084 $owner = -1,
00085 $question = ""
00086 )
00087 {
00088 $this->ASS_Question($title, $comment, $author, $owner);
00089 $this->question = $question;
00090 $this->maxNumOfChars = 0;
00091 $this->points = 0;
00092 }
00093
00102 function isComplete()
00103 {
00104 if (($this->title) and ($this->author) and ($this->question))
00105 {
00106 return true;
00107 }
00108 else
00109 {
00110 return false;
00111 }
00112 }
00113
00123 function from_xml($xml_text)
00124 {
00125 $result = false;
00126 if (!empty($this->domxml))
00127 {
00128 $this->domxml->free();
00129 }
00130 $xml_text = preg_replace("/>\s*?</", "><", $xml_text);
00131 $this->domxml = domxml_open_mem($xml_text);
00132 if (!empty($this->domxml))
00133 {
00134 $root = $this->domxml->document_element();
00135 $item = $root->first_child();
00136 $this->setTitle($item->get_attribute("title"));
00137 $this->gaps = array();
00138 $itemnodes = $item->child_nodes();
00139 foreach ($itemnodes as $index => $node)
00140 {
00141 switch ($node->node_name())
00142 {
00143 case "qticomment":
00144 $comment = $node->get_content();
00145 if (strpos($comment, "ILIAS Version=") !== false)
00146 {
00147 }
00148 elseif (strpos($comment, "Questiontype=") !== false)
00149 {
00150 }
00151 elseif (strpos($comment, "Author=") !== false)
00152 {
00153 $comment = str_replace("Author=", "", $comment);
00154 $this->setAuthor($comment);
00155 }
00156 else
00157 {
00158 $this->setComment($comment);
00159 }
00160 break;
00161 case "itemmetadata":
00162 $md_array = array();
00163 $metanodes = $node->child_nodes();
00164 foreach ($metanodes as $metanode)
00165 {
00166 switch ($metanode->node_name())
00167 {
00168 case "qtimetadata":
00169 $metafields = $metanode->child_nodes();
00170 foreach ($metafields as $metafield)
00171 {
00172 switch ($metafield->node_name())
00173 {
00174 case "qtimetadatafield":
00175 $metafieldlist = $metafield->child_nodes();
00176 $md = array("label" => "", "entry" => "");
00177 foreach ($metafieldlist as $attr)
00178 {
00179 switch ($attr->node_name())
00180 {
00181 case "fieldlabel":
00182 $md["label"] = $attr->get_content();
00183 break;
00184 case "fieldentry":
00185 $md["entry"] = $attr->get_content();
00186 break;
00187 }
00188 }
00189 array_push($md_array, $md);
00190 break;
00191 }
00192 }
00193 break;
00194 }
00195 }
00196 foreach ($md_array as $md)
00197 {
00198 switch ($md["label"])
00199 {
00200 case "ILIAS_VERSION":
00201 break;
00202 case "QUESTIONTYPE":
00203 break;
00204 case "AUTHOR":
00205 $this->setAuthor($md["entry"]);
00206 break;
00207 }
00208 }
00209 break;
00210 case "duration":
00211 $iso8601period = $node->get_content();
00212 if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
00213 {
00214 $this->setEstimatedWorkingTime($matches[4], $matches[5], $matches[6]);
00215 }
00216 break;
00217 case "presentation":
00218 $flow = $node->first_child();
00219 $flownodes = $flow->child_nodes();
00220 foreach ($flownodes as $idx => $flownode)
00221 {
00222 if (strcmp($flownode->node_name(), "material") == 0)
00223 {
00224 $mattext = $flownode->first_child();
00225 $this->set_question($mattext->get_content());
00226 }
00227 elseif (strcmp($flownode->node_name(), "response_str") == 0)
00228 {
00229 $subnodes = $flownode->child_nodes();
00230 foreach ($subnodes as $node_type)
00231 {
00232 switch ($node_type->node_name())
00233 {
00234 case "render_fib":
00235 $render_choice = $node_type;
00236 if (strcmp($render_choice->node_name(), "render_fib") == 0)
00237 {
00238
00239 $maxchars = $render_choice->get_attribute("maxchars");
00240 $this->setMaxNumOfChars($maxchars);
00241 }
00242 break;
00243 case "material":
00244 $matlabel = $node_type->get_attribute("label");
00245 if (strcmp($matlabel, "suggested_solution") == 0)
00246 {
00247 $mattype = $node_type->first_child();
00248 if (strcmp($mattype->node_name(), "mattext") == 0)
00249 {
00250 $suggested_solution = $mattype->get_content();
00251 if ($suggested_solution)
00252 {
00253 if ($this->getId() < 1)
00254 {
00255 $this->saveToDb();
00256 }
00257 $this->setSuggestedSolution($suggested_solution, 0, true);
00258 }
00259 }
00260 }
00261 break;
00262 }
00263 }
00264 }
00265 }
00266 break;
00267 case "resprocessing":
00268 $resproc_nodes = $node->child_nodes();
00269 foreach ($resproc_nodes as $index => $respcondition)
00270 {
00271 if (strcmp($respcondition->node_name(), "outcomes") == 0)
00272 {
00273 $outcomes_nodes = $respcondition->child_nodes();
00274 foreach ($outcomes_nodes as $oidx => $decvar)
00275 {
00276 if (strcmp($decvar->node_name(), "decvar") == 0)
00277 {
00278 $maxpoints = $decvar->get_attribute("maxvalue");
00279 $this->setPoints($maxpoints);
00280 }
00281 }
00282 }
00283 }
00284 break;
00285 }
00286 }
00287 $result = true;
00288 }
00289 return $result;
00290 }
00291
00301 function to_xml($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false)
00302 {
00303 if (!empty($this->domxml))
00304 {
00305 $this->domxml->free();
00306 }
00307 $xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
00308 $xml_header .= "<questestinterop></questestinterop>\n";
00309 $this->domxml = domxml_open_mem($xml_header);
00310 $root = $this->domxml->document_element();
00311
00312 $qtiIdent = $this->domxml->create_element("item");
00313 $qtiIdent->set_attribute("ident", "il_".IL_INST_ID."_qst_".$this->getId());
00314 $qtiIdent->set_attribute("title", $this->getTitle());
00315 $root->append_child($qtiIdent);
00316
00317 $qtiComment = $this->domxml->create_element("qticomment");
00318 $qtiCommentText = $this->domxml->create_text_node($this->getComment());
00319 $qtiComment->append_child($qtiCommentText);
00320 $qtiIdent->append_child($qtiComment);
00321
00322 $qtiDuration = $this->domxml->create_element("duration");
00323 $workingtime = $this->getEstimatedWorkingTime();
00324 $qtiDurationText = $this->domxml->create_text_node(sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]));
00325 $qtiDuration->append_child($qtiDurationText);
00326 $qtiIdent->append_child($qtiDuration);
00327
00328 $qtiItemmetadata = $this->domxml->create_element("itemmetadata");
00329 $qtiMetadata = $this->domxml->create_element("qtimetadata");
00330
00331 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00332 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00333 $qtiFieldlabelText = $this->domxml->create_text_node("ILIAS_VERSION");
00334 $qtiFieldlabel->append_child($qtiFieldlabelText);
00335 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00336 $qtiFieldentryText = $this->domxml->create_text_node($this->ilias->getSetting("ilias_version"));
00337 $qtiFieldentry->append_child($qtiFieldentryText);
00338 $qtiMetadatafield->append_child($qtiFieldlabel);
00339 $qtiMetadatafield->append_child($qtiFieldentry);
00340 $qtiMetadata->append_child($qtiMetadatafield);
00341
00342 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00343 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00344 $qtiFieldlabelText = $this->domxml->create_text_node("QUESTIONTYPE");
00345 $qtiFieldlabel->append_child($qtiFieldlabelText);
00346 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00347 $qtiFieldentryText = $this->domxml->create_text_node(TEXT_QUESTION_IDENTIFIER);
00348 $qtiFieldentry->append_child($qtiFieldentryText);
00349 $qtiMetadatafield->append_child($qtiFieldlabel);
00350 $qtiMetadatafield->append_child($qtiFieldentry);
00351 $qtiMetadata->append_child($qtiMetadatafield);
00352
00353 $qtiMetadatafield = $this->domxml->create_element("qtimetadatafield");
00354 $qtiFieldlabel = $this->domxml->create_element("fieldlabel");
00355 $qtiFieldlabelText = $this->domxml->create_text_node("AUTHOR");
00356 $qtiFieldlabel->append_child($qtiFieldlabelText);
00357 $qtiFieldentry = $this->domxml->create_element("fieldentry");
00358 $qtiFieldentryText = $this->domxml->create_text_node($this->getAuthor());
00359 $qtiFieldentry->append_child($qtiFieldentryText);
00360 $qtiMetadatafield->append_child($qtiFieldlabel);
00361 $qtiMetadatafield->append_child($qtiFieldentry);
00362 $qtiMetadata->append_child($qtiMetadatafield);
00363
00364 $qtiItemmetadata->append_child($qtiMetadata);
00365 $qtiIdent->append_child($qtiItemmetadata);
00366
00367
00368 $qtiPresentation = $this->domxml->create_element("presentation");
00369 $qtiPresentation->set_attribute("label", $this->getTitle());
00370
00371 $qtiFlow = $this->domxml->create_element("flow");
00372
00373 $qtiMaterial = $this->domxml->create_element("material");
00374 $qtiMatText = $this->domxml->create_element("mattext");
00375 $qtiMatTextText = $this->domxml->create_text_node($this->get_question());
00376 $qtiMatText->append_child($qtiMatTextText);
00377 $qtiMaterial->append_child($qtiMatText);
00378 $qtiFlow->append_child($qtiMaterial);
00379
00380 $qtiResponseStr = $this->domxml->create_element("response_str");
00381 $qtiResponseStr->set_attribute("ident", "TEXT");
00382 $qtiResponseStr->set_attribute("rcardinality", "Ordered");
00383 $qtiRenderFib = $this->domxml->create_element("render_fib");
00384 $qtiRenderFib->set_attribute("fibtype", "String");
00385 $qtiRenderFib->set_attribute("prompt", "Box");
00386 $qtiResponseLabel = $this->domxml->create_element("response_label");
00387 $qtiResponseLabel->set_attribute("ident", "A");
00388 $qtiRenderFib->append_child($qtiResponseLabel);
00389 $qtiResponseStr->append_child($qtiRenderFib);
00390 if ($this->getMaxNumOfChars() > 0)
00391 {
00392 $qtiRenderFib->set_attribute("maxchars", $this->getMaxNumOfChars());
00393 }
00394 $solution = $this->getSuggestedSolution(0);
00395 if (count($solution))
00396 {
00397 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches))
00398 {
00399 $qtiMaterial = $this->domxml->create_element("material");
00400 $qtiMaterial->set_attribute("label", "suggested_solution");
00401 $qtiMatText = $this->domxml->create_element("mattext");
00402 $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
00403 if (strcmp($matches[1], "") != 0)
00404 {
00405 $intlink = $solution["internal_link"];
00406 }
00407 $qtiMatTextText = $this->domxml->create_text_node($intlink);
00408 $qtiMatText->append_child($qtiMatTextText);
00409 $qtiMaterial->append_child($qtiMatText);
00410 $qtiResponseStr->append_child($qtiMaterial);
00411 }
00412 }
00413 $qtiFlow->append_child($qtiResponseStr);
00414 $qtiPresentation->append_child($qtiFlow);
00415 $qtiIdent->append_child($qtiPresentation);
00416
00417 $qtiResprocessing = $this->domxml->create_element("resprocessing");
00418 $qtiResprocessing->set_attribute("scoremodel", "HumanRater");
00419 $qtiOutcomes = $this->domxml->create_element("outcomes");
00420 $qtiDecvar = $this->domxml->create_element("decvar");
00421 $qtiDecvar->set_attribute("varname", "WritingScore");
00422 $qtiDecvar->set_attribute("vartype", "Integer");
00423 $qtiDecvar->set_attribute("minvalue", "0");
00424 $qtiDecvar->set_attribute("maxvalue", $this->getPoints());
00425 $qtiOutcomes->append_child($qtiDecvar);
00426 $qtiResprocessing->append_child($qtiOutcomes);
00427 $qtiOther = $this->domxml->create_element("other");
00428 $qtiOtherText = $this->domxml->create_text_node("tutor rated");
00429 $qtiOther->append_child($qtiOtherText);
00430 $qtiConditionVar = $this->domxml->create_element("conditionvar");
00431 $qtiConditionVar->append_child($qtiOther);
00432 $qtiRespCondition = $this->domxml->create_element("respcondition");
00433 $qtiRespCondition->append_child($qtiConditionVar);
00434 $qtiResprocessing->append_child($qtiRespCondition);
00435
00436 $qtiIdent->append_child($qtiResprocessing);
00437
00438 $xml = $this->domxml->dump_mem(true);
00439 if (!$a_include_header)
00440 {
00441 $pos = strpos($xml, "?>");
00442 $xml = substr($xml, $pos + 2);
00443 }
00444 return $xml;
00445 }
00446
00455 function saveToDb($original_id = "")
00456 {
00457 global $ilias;
00458
00459 $complete = 0;
00460 if ($this->isComplete())
00461 {
00462 $complete = 1;
00463 }
00464 $db = & $ilias->db;
00465
00466 $estw_time = $this->getEstimatedWorkingTime();
00467 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
00468
00469 if ($original_id)
00470 {
00471 $original_id = $db->quote($original_id);
00472 }
00473 else
00474 {
00475 $original_id = "NULL";
00476 }
00477
00478 if ($this->id == -1)
00479 {
00480
00481 $now = getdate();
00482 $question_type = $this->getQuestionType();
00483 $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
00484 $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)",
00485 $db->quote($question_type),
00486 $db->quote($this->obj_id),
00487 $db->quote($this->title),
00488 $db->quote($this->comment),
00489 $db->quote($this->author),
00490 $db->quote($this->owner),
00491 $db->quote($this->getPoints() . ""),
00492 $db->quote($this->question),
00493 $db->quote($estw_time),
00494 $db->quote($this->getMaxNumOfChars()),
00495 $db->quote("$complete"),
00496 $db->quote($created),
00497 $original_id
00498 );
00499 $result = $db->query($query);
00500
00501 if ($result == DB_OK)
00502 {
00503 $this->id = $this->ilias->db->getLastInsertId();
00504
00505
00506 $this->createPageObject();
00507
00508
00509 if ($this->getTestId() > 0)
00510 {
00511 $this->insertIntoTest($this->getTestId());
00512 }
00513 }
00514 }
00515 else
00516 {
00517
00518 $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",
00519 $db->quote($this->obj_id. ""),
00520 $db->quote($this->title),
00521 $db->quote($this->comment),
00522 $db->quote($this->author),
00523 $db->quote($this->getPoints() . ""),
00524 $db->quote($this->question),
00525 $db->quote($estw_time),
00526 $db->quote($this->getMaxNumOfChars()),
00527 $db->quote("$complete"),
00528 $db->quote($this->id)
00529 );
00530 $result = $db->query($query);
00531 }
00532 parent::saveToDb($original_id);
00533 }
00534
00544 function loadFromDb($question_id)
00545 {
00546 global $ilias;
00547
00548 $db = & $ilias->db;
00549 $query = sprintf("SELECT * FROM qpl_questions WHERE question_id = %s",
00550 $db->quote($question_id));
00551 $result = $db->query($query);
00552 if (strcmp(strtolower(get_class($result)), db_result) == 0)
00553 {
00554 if ($result->numRows() == 1)
00555 {
00556 $data = $result->fetchRow(DB_FETCHMODE_OBJECT);
00557 $this->id = $question_id;
00558 $this->title = $data->title;
00559 $this->comment = $data->comment;
00560 $this->solution_hint = $data->solution_hint;
00561 $this->original_id = $data->original_id;
00562 $this->obj_id = $data->obj_fi;
00563 $this->author = $data->author;
00564 $this->owner = $data->owner;
00565 $this->question = $data->question_text;
00566 $this->maxNumOfChars = $data->maxNumOfChars;
00567 $this->points = $data->points;
00568 $this->setEstimatedWorkingTime(substr($data->working_time, 0, 2), substr($data->working_time, 3, 2), substr($data->working_time, 6, 2));
00569 }
00570 }
00571 parent::loadFromDb($question_id);
00572 }
00573
00581 function duplicate($for_test = true, $title = "", $author = "", $owner = "")
00582 {
00583 if ($this->id <= 0)
00584 {
00585
00586 return;
00587 }
00588
00589 $clone = $this;
00590 include_once ("./assessment/classes/class.assQuestion.php");
00591 $original_id = ASS_Question::_getOriginalId($this->id);
00592 $clone->id = -1;
00593 if ($title)
00594 {
00595 $clone->setTitle($title);
00596 }
00597
00598 if ($author)
00599 {
00600 $clone->setAuthor($author);
00601 }
00602 if ($owner)
00603 {
00604 $clone->setOwner($owner);
00605 }
00606
00607 if ($for_test)
00608 {
00609 $clone->saveToDb($original_id);
00610 }
00611 else
00612 {
00613 $clone->saveToDb();
00614 }
00615
00616
00617 $clone->copyPageOfQuestion($original_id);
00618
00619 return $clone->id;
00620 }
00621
00631 function get_question()
00632 {
00633 return $this->question;
00634 }
00635
00645 function set_question($question = "")
00646 {
00647 $this->question = $question;
00648 }
00649
00659 function getMaxNumOfChars()
00660 {
00661 if (strcmp($this->maxNumOfChars, "") == 0)
00662 {
00663 return 0;
00664 }
00665 else
00666 {
00667 return $this->maxNumOfChars;
00668 }
00669 }
00670
00680 function setMaxNumOfChars($maxchars = 0)
00681 {
00682 $this->maxNumOfChars = $maxchars;
00683 }
00684
00694 function getPoints()
00695 {
00696 if (strcmp($this->points, "") == 0)
00697 {
00698 return 0;
00699 }
00700 else
00701 {
00702 return $this->points;
00703 }
00704 }
00705
00715 function setPoints($points = 0)
00716 {
00717 $this->points = $points;
00718 }
00719
00728 function getMaximumPoints()
00729 {
00730 return $this->points;
00731 }
00732
00744 function setReachedPoints($user_id, $test_id, $points)
00745 {
00746 if (($points > 0) && ($points <= $this->getPoints()))
00747 {
00748 $query = sprintf("UPDATE tst_solutions SET points = %s WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00749 $this->ilias->db->quote($points . ""),
00750 $this->ilias->db->quote($user_id . ""),
00751 $this->ilias->db->quote($test_id . ""),
00752 $this->ilias->db->quote($this->getId() . "")
00753 );
00754 $result = $this->ilias->db->query($query);
00755
00756 return true;
00757 }
00758 else
00759 {
00760 return false;
00761 }
00762 }
00763
00776 function _setReachedPoints($user_id, $test_id, $question_id, $points, $maxpoints)
00777 {
00778 global $ilDB;
00779
00780 if (($points > 0) && ($points <= $maxpoints))
00781 {
00782 $query = sprintf("UPDATE tst_solutions SET points = %s WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00783 $ilDB->quote($points . ""),
00784 $ilDB->quote($user_id . ""),
00785 $ilDB->quote($test_id . ""),
00786 $ilDB->quote($question_id . "")
00787 );
00788 $result = $this->ilias->db->query($query);
00789
00790
00791 include_once 'course/classes/class.ilCourseObjectiveResult.php';
00792
00793 ilCourseObjectiveResult::_updateUserResult($user_id,$question_id,$points);
00794
00795
00796 return true;
00797 }
00798 else
00799 {
00800 return false;
00801 }
00802 }
00803
00813 function getReachedPoints($user_id, $test_id)
00814 {
00815 $query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00816 $this->ilias->db->quote($user_id),
00817 $this->ilias->db->quote($test_id),
00818 $this->ilias->db->quote($this->getId())
00819 );
00820 $result = $this->ilias->db->query($query);
00821 if ($result->numRows() == 1)
00822 {
00823 $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
00824 if ($row["points"])
00825 {
00826 return $row["points"];
00827 }
00828 }
00829 return 0;
00830 }
00831
00843 function _getReachedPoints($user_id, $test_id)
00844 {
00845 return 0;
00846 }
00847
00857 function getReachedInformation($user_id, $test_id)
00858 {
00859 $found_values = array();
00860 $query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00861 $this->ilias->db->quote($user_id),
00862 $this->ilias->db->quote($test_id),
00863 $this->ilias->db->quote($this->getId())
00864 );
00865 $result = $this->ilias->db->query($query);
00866 $user_result = array();
00867 while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT))
00868 {
00869 $user_result = array(
00870 "value" => $data->value1
00871 );
00872 }
00873 return $user_result;
00874 }
00875
00886 function saveWorkingData($test_id, $limit_to = LIMIT_NO_LIMIT)
00887 {
00888 global $ilDB;
00889 global $ilUser;
00890
00891 $db =& $ilDB->db;
00892
00893 $query = sprintf("DELETE FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
00894 $db->quote($ilUser->id),
00895 $db->quote($test_id),
00896 $db->quote($this->getId())
00897 );
00898 $result = $db->query($query);
00899
00900 $text = ilUtil::stripSlashes($_POST["TEXT"]);
00901 if ($this->getMaxNumOfChars())
00902 {
00903 $text = substr($text, 0, $this->getMaxNumOfChars());
00904 }
00905 $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)",
00906 $db->quote($ilUser->id),
00907 $db->quote($test_id),
00908 $db->quote($this->getId()),
00909 $db->quote($text)
00910 );
00911 $result = $db->query($query);
00912 return true;
00913 }
00914
00915 function syncWithOriginal()
00916 {
00917 global $ilias;
00918 if ($this->original_id)
00919 {
00920 $complete = 0;
00921 if ($this->isComplete())
00922 {
00923 $complete = 1;
00924 }
00925 $db = & $ilias->db;
00926
00927 $estw_time = $this->getEstimatedWorkingTime();
00928 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
00929
00930 $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",
00931 $db->quote($this->obj_id. ""),
00932 $db->quote($this->title. ""),
00933 $db->quote($this->comment. ""),
00934 $db->quote($this->author. ""),
00935 $db->quote($this->question. ""),
00936 $db->quote($estw_time. ""),
00937 $db->quote($this->maxNumOfChars. ""),
00938 $db->quote($complete. ""),
00939 $db->quote($this->original_id. "")
00940 );
00941 $result = $db->query($query);
00942
00943 parent::syncWithOriginal();
00944 }
00945 }
00946
00947 function createRandomSolution($test_id, $user_id)
00948 {
00949 }
00950
00959 function getQuestionType()
00960 {
00961 return 8;
00962 }
00963 }
00964
00965 ?>