4include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   27                self::IMG_MIME_TYPE_JPG => array(
'jpg', 
'jpeg'),
 
   28                self::IMG_MIME_TYPE_PNG => array(
'png'),
 
   29                self::IMG_MIME_TYPE_GIF => array(
'gif')
 
   33                self::IMG_MIME_TYPE_JPG => array(
'binary'),
 
   34                self::IMG_MIME_TYPE_PNG => array(
'binary'),
 
   35                self::IMG_MIME_TYPE_GIF => array(
'binary')
 
  290                $this->original_id = 
null;
 
  298                        $this->author = $this->
ilias->account->fullname;
 
  301                if ($this->owner <= 0)
 
  303                        $this->owner = $this->
ilias->account->id;
 
  307                $this->suggested_solutions = array();
 
  309                $this->nr_of_tries = 0;
 
  312                $this->arrData = array();
 
  315                $this->questionActionCmd = 
'handleQuestionAction';
 
  317                $this->lastChange = 
null;
 
  319                require_once 
'Services/Randomization/classes/class.ilArrayElementOrderKeeper.php';
 
  337                return (
bool)count(self::getAllowedFileExtensionsForMimeType($mimeType));
 
  342                return current(explode(
';', $contentTypeString));
 
  347                foreach(self::$allowedFileExtensionsByMimeType as $allowedMimeType => $extensions)
 
  349                        $rexCharsets = implode(
'|', self::$allowedCharsetsByMimeType[$allowedMimeType]);
 
  350                        $rexMimeType = preg_quote($allowedMimeType, 
'/');
 
  352                        $rex = 
'/^'.$rexMimeType.
'(;(\s)*charset=('.$rexCharsets.
'))*$/';
 
  354                        if( !preg_match($rex, $mimeType) )
 
  368                        strtolower($fileExtension), self::getAllowedFileExtensionsForMimeType($mimeType)
 
  374                $allowedExtensions = array();
 
  376                foreach(self::$allowedFileExtensionsByMimeType as $mimeType => $fileExtensions)
 
  378                         $allowedExtensions = array_merge($allowedExtensions, $fileExtensions);
 
  381                return $allowedExtensions;
 
  427        function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 
  429                include_once 
"./Modules/TestQuestionPool/classes/import/qti12/class." . $this->
getQuestionType() . 
"Import.php";
 
  431                $import = 
new $classname($this);
 
  432                $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
 
  441        function toXML($a_include_header = 
true, $a_include_binary = 
true, $a_shuffle = 
false, $test_output = 
false, $force_image_references = 
false)
 
  443                include_once 
"./Modules/TestQuestionPool/classes/export/qti12/class." . $this->
getQuestionType() . 
"Export.php";
 
  445                $export = 
new $classname($this);
 
  446                return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
 
  471                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_questions WHERE obj_fi = %s AND title = %s",
 
  472                        array(
'integer',
'text'),
 
  473                        array($questionpool_id, 
$title)
 
  475                return (
$result->numRows() > 0) ? TRUE : FALSE;
 
  511                $this->test_id = 
$id;
 
  570                $this->est_working_time = array(
"h" => (
int)$hour, 
"m" => (
int)$min, 
"s" => (
int)$sec);
 
  581                $this->est_working_time = array(
 
  582                        'h' => (
int)substr($durationString, 0, 2),
 
  583                        'm' => (
int)substr($durationString, 3, 2),
 
  584                        's' => (
int)substr($durationString, 6, 2)
 
  599                        foreach ($array as $key => $value)
 
  601                                if (strcmp($key, $searchkey)==0)
 
  740                if (!$this->est_working_time)
 
  742                        $this->est_working_time = array(
"h" => 0, 
"m" => 0, 
"s" => 0);
 
  808                if(!strlen($this->external_id))
 
  810                        if($this->
getId() > 0)
 
  812                                return 'il_' . IL_INST_ID . 
'_qst_' . $this->
getId();
 
  816                                return uniqid(
'', 
true);
 
  836                $result = 
$ilDB->queryF(
"SELECT points FROM qpl_questions WHERE question_id = %s",
 
  858                $result = 
$ilDB->queryF(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
  879                $result = 
$ilDB->queryF(
"SELECT suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
 
  896                return $question->getSuggestedSolutionOutput();
 
  902                foreach ($this->suggested_solutions as $solution)
 
  904                        switch ($solution[
"type"])
 
  913                                        $possible_texts = array_values(array_filter(array(
 
  916                                                $this->lng->txt(
'tst_show_solution_suggested')
 
  918                                        array_push($output, 
'<a href="' . $this->
getSuggestedSolutionPathWeb() . $solution[
"value"][
"name"] . 
'">' . $possible_texts[0] . 
'</a>');
 
  921                                        $solutionValue = $solution[
"value"];
 
  922                                        $solutionValue = $this->
fixSvgToPng($solutionValue);
 
  928                return join($output, 
"<br />");
 
  943                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
 
  944                        array(
'integer',
'integer'),
 
  945                        array($question_id, $subquestion_index)
 
  951                                "internal_link" => 
$row[
"internal_link"],
 
  952                                "import_id" => 
$row[
"import_id"]
 
  985                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  988                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
  989                        array(
'integer',
'integer',
'integer'),
 
  990                        array($active_id, $question_id, 
$pass)
 
 1039                    include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1049            require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 1051            $requestsStatisticData = $hintTracking->getRequestStatisticDataByQuestionAndTestpass();
 
 1052            $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
 
 1057            return $reached_points;
 
 1073                if( is_null(
$pass) )
 
 1075                        include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1083                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 1085                $requestsStatisticData = $questionHintTracking->getRequestStatisticDataByQuestionAndTestpass();
 
 1086                $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
 
 1100                if( is_null($reached_points) ) $reached_points = 0;
 
 1105                        DELETE FROM             tst_test_result 
 1107                        WHERE                   active_fi = %s 
 1108                        AND                             question_fi = %s 
 1112                $types = array(
'integer', 
'integer', 
'integer');
 
 1113                $values = array($active_id, $this->
getId(), 
$pass);
 
 1115                if( $this->
getStep() !== NULL )
 
 1121                        $types[] = 
'integer';
 
 1125                $affectedRows = 
$ilDB->manipulateF(
$query, $types, $values);
 
 1127                $next_id = 
$ilDB->nextId(
"tst_test_result");
 
 1130                        'test_result_id'        => array(
'integer', $next_id),
 
 1131                        'active_fi'                     => array(
'integer', $active_id),
 
 1132                        'question_fi'           => array(
'integer', $this->
getId()),
 
 1133                        'pass'                          => array(
'integer', 
$pass),
 
 1134                        'points'                        => array(
'float', $reached_points),
 
 1135                        'tstamp'                        => array(
'integer', time()),
 
 1136                        'hint_count'            => array(
'integer', $requestsStatisticData->getRequestsCount()),
 
 1137                        'hint_points'           => array(
'float', $requestsStatisticData->getRequestsPoints()),
 
 1138                        'answered'                      => array(
'integer', $isAnswered)
 
 1141                if( $this->
getStep() !== NULL )
 
 1143                        $fieldData[
'step'] = array(
'integer', $this->
getStep());
 
 1146                $ilDB->insert(
'tst_test_result', $fieldData);
 
 1150                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1170                include_once 
'Modules/Course/classes/class.ilCourseObjectiveResult.php';
 
 1184                if( 
$pass === 
null )
 
 1186                        require_once 
'Modules/Test/classes/class.ilObjTest.php';
 
 1199                $this->reworkWorkingData($active_id, 
$pass, $obligationsEnabled, $authorized);
 
 1251                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1252                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 1257                        SELECT          tst_pass_result.* 
 1258                        FROM            tst_pass_result 
 1259                        WHERE           active_fi = %s 
 1264                        $query, array(
'integer',
'integer'), array($active_id, 
$pass)
 
 1269                $max = 
$row[
'maxpoints'];
 
 1270                $reached = 
$row[
'points'];
 
 1272                $obligationsAnswered = (int)
$row[
'obligations_answered'];
 
 1274                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 1276                $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
 
 1278                $mark = ASS_MarkSchema::_getMatchingMarkFromActiveId($active_id, $percentage);
 
 1280                $isPassed = (  $mark[
"passed"] ? 1 : 0 );
 
 1281                $isFailed = ( !$mark[
"passed"] ? 1 : 0 );
 
 1289                        DELETE FROM             tst_result_cache 
 1290                        WHERE                   active_fi = %s 
 1293                $affectedRows = 
$ilDB->manipulateF(
 
 1294                        $query, array(
'integer'), array($active_id)
 
 1297                $ilDB->insert(
'tst_result_cache', array(
 
 1298                        'active_fi'=> array(
'integer', $active_id),
 
 1299                        'pass'=> array(
'integer', strlen(
$pass) ? 
$pass : 0),
 
 1300                        'max_points'=> array(
'float', strlen($max) ? $max : 0),
 
 1301                        'reached_points'=> array(
'float', strlen($reached) ? $reached : 0),
 
 1302                        'mark_short'=> array(
'text', strlen($mark[
"short_name"]) ? $mark[
"short_name"] : 
" "),
 
 1303                        'mark_official'=> array(
'text', strlen($mark[
"official_name"]) ? $mark[
"official_name"] : 
" "),
 
 1304                        'passed'=> array(
'integer', $isPassed),
 
 1305                        'failed'=> array(
'integer', $isFailed),
 
 1306                        'tstamp'=> array(
'integer', time()),
 
 1307                        'hint_count'=> array(
'integer', 
$row[
'hint_count']),
 
 1308                        'hint_points'=> array(
'float', 
$row[
'hint_points']),
 
 1309                        'obligations_answered' => array(
'integer', $obligationsAnswered)
 
 1323                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1325                if( self::getResultGateway() !== 
null )
 
 1340                        SELECT          SUM(points) reachedpoints, 
 1341                                                SUM(hint_count) hint_count, 
 1342                                                SUM(hint_points) hint_points, 
 1343                                                COUNT(DISTINCT(question_fi)) answeredquestions 
 1344                        FROM            tst_test_result 
 1345                        WHERE           active_fi = %s 
 1348                        array(
'integer',
'integer'),
 
 1349                        array($active_id, 
$pass)
 
 1354                        if( $obligationsEnabled )
 
 1357                                        SELECT          count(*) cnt, 
 1358                                                                min( answered ) answ 
 1359                                        FROM            tst_test_question 
 1360                                        INNER JOIN      tst_active 
 1362                                        AND                     tst_test_question.test_fi = tst_active.test_fi 
 1363                                        LEFT JOIN       tst_test_result 
 1364                                        ON                      tst_test_result.active_fi = %s 
 1365                                        AND                     tst_test_result.pass = %s 
 1366                                        AND                     tst_test_question.question_fi = tst_test_result.question_fi 
 1367                                        WHERE           obligatory = 1';
 
 1369                                $result_obligatory = 
$ilDB->queryF(
 
 1370                                        $query, array(
'integer',
'integer',
'integer'), array($active_id, $active_id, 
$pass)
 
 1373                                $row_obligatory = 
$ilDB->fetchAssoc($result_obligatory);
 
 1375                                if ($row_obligatory[
'cnt'] == 0)
 
 1377                                        $obligations_answered = 1;
 
 1381                                        $obligations_answered = (int) $row_obligatory[
'answ'];
 
 1386                                $obligations_answered = 1;
 
 1391                        if( 
$row[
'hint_count'] === 
null ) 
$row[
'hint_count'] = 0;
 
 1392                        if( 
$row[
'hint_points'] === 
null ) 
$row[
'hint_points'] = 0;
 
 1414                        $ilDB->replace(
'tst_pass_result', 
 
 1416                                                                'active_fi'                     => array(
'integer', $active_id), 
 
 1417                                                                'pass'                                  => array(
'integer', strlen(
$pass) ? 
$pass : 0)),
 
 1419                                                                'points'                                => array(
'float',       
$row[
'reachedpoints'] ? 
$row[
'reachedpoints'] : 0),
 
 1420                                                                'maxpoints'                             => array(
'float',       
$data[
'points']),
 
 1421                                                                'questioncount'                 => array(
'integer', 
$data[
'count']),
 
 1422                                                                'answeredquestions'             => array(
'integer', 
$row[
'answeredquestions']),
 
 1423                                                                'workingtime'                   => array(
'integer', $time),
 
 1424                                                                'tstamp'                                => array(
'integer', time()),
 
 1425                                                                'hint_count'                    => array(
'integer', 
$row[
'hint_count']),
 
 1426                                                                'hint_points'                   => array(
'float',       
$row[
'hint_points']),
 
 1427                                                                'obligations_answered'  => array(
'integer', $obligations_answered),
 
 1428                                                                'exam_id'                               => array(
'text',        $exam_identifier)
 
 1458                        'active_fi' => $active_id,
 
 1460                        'points' => (
$row[
"reachedpoints"]) ? 
$row[
"reachedpoints"] : 0,
 
 1461                        'maxpoints' => 
$data[
"points"],
 
 1462                        'questioncount' => 
$data[
"count"],
 
 1463                        'answeredquestions' => 
$row[
"answeredquestions"],
 
 1464                        'workingtime' => $time,
 
 1466                        'hint_count' => 
$row[
'hint_count'],
 
 1467                        'hint_points' => 
$row[
'hint_points'],
 
 1468                        'obligations_answered' => $obligations_answered,
 
 1469                        'exam_id' => $exam_identifier
 
 1480        function logAction($logtext = 
"", $active_id = 
"", $question_id = 
"")
 
 1485                if (strcmp($question_id, 
"") != 0)
 
 1487                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1490                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1491                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1502        function _logAction($logtext = 
"", $active_id = 
"", $question_id = 
"")
 
 1507                if (strcmp($question_id, 
"") != 0)
 
 1509                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1512                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1513                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1526                $mediatempdir = CLIENT_WEB_DIR . 
"/assessment/temp";
 
 1528                $temp_name = tempnam($mediatempdir, $name . 
"_____");
 
 1529                $temp_name = str_replace(
"\\", 
"/", $temp_name);
 
 1530                @unlink($temp_name);
 
 1547                return CLIENT_WEB_DIR . 
"/assessment/$this->obj_id/$this->id/solution/";
 
 1557                return CLIENT_WEB_DIR . 
"/assessment/$this->obj_id/$this->id/java/";
 
 1568                if( $question_id === 
null)
 
 1573                if( $object_id === 
null)
 
 1583                return CLIENT_WEB_DIR . 
"/assessment/{$parentObjectId}/{$questionId}/images/";
 
 1594                return CLIENT_WEB_DIR . 
"/assessment/$this->obj_id/$this->id/flash/";
 
 1605                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1617                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1630                if(!$this->export_image_path)
 
 1632                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1650                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1659                if( !count($solution) )
 
 1679                if( $this->
getStep() !== NULL )
 
 1684                                WHERE active_fi = %s 
 1685                                AND question_fi = %s 
 1689                                ORDER BY solution_id";
 
 1691                        $result = 
$ilDB->queryF(
$query, array(
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 1692                                array($active_id, $this->
getId(), $pass, $this->
getStep(), (
int)$authorized)
 
 1700                                WHERE active_fi = %s 
 1701                                AND question_fi = %s  
 1704                                ORDER BY solution_id 
 1708                                array($active_id, $this->
getId(), $pass, (
int)$authorized)
 
 1732                if ($question_id < 1) $question_id = $this->
getId();
 
 1733                $result = $ilDB->queryF(
"SELECT COUNT(qpl_questions.question_id) question_count FROM qpl_questions, tst_test_question WHERE qpl_questions.original_id = %s AND qpl_questions.question_id = tst_test_question.question_fi",
 
 1738                $count = 
$row[
"question_count"];
 
 1740                $result = 
$ilDB->queryF(
"SELECT DISTINCT tst_active.test_fi, qpl_questions.question_id FROM qpl_questions, tst_test_rnd_qst, tst_active WHERE qpl_questions.original_id = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.active_fi = tst_active.active_id",
 
 1759                if ($question_id < 1) $question_id = 
$this->id;
 
 1760                $result = 
$ilDB->queryF(
"SELECT original_id FROM qpl_questions WHERE question_id = %s",
 
 1765                return (
$row[
"original_id"] > 0) ? TRUE : FALSE;
 
 1776                $keys = array_keys($array);
 
 1779                foreach ($keys as $key)
 
 1795                $result = 
$ilDB->queryF(
"SELECT qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 1800                return $data[
"type_tag"];
 
 1836                if( !is_array($answer_table_name) )
 
 1838                        $answer_table_name = array($answer_table_name);
 
 1841                foreach ($answer_table_name as $table)
 
 1845                                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM $table WHERE question_fi = %s",
 
 1865                if( !is_array($additional_table_name) )
 
 1867                        $additional_table_name = array($additional_table_name);
 
 1870                foreach ($additional_table_name as $table)
 
 1874                                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM $table WHERE question_fi = %s",
 
 1890                include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 1902        public function delete($question_id)
 
 1906                if ($question_id < 1) 
return true; 
 
 1908                $result = 
$ilDB->queryF(
"SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
 
 1925                catch (Exception $e)
 
 1927                        $ilLog->write(
"EXCEPTION: Could not delete page of question $question_id: $e");
 
 1931                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM qpl_questions WHERE question_id = %s",
 
 1935                if ($affectedRows == 0) 
return false;
 
 1944                catch (Exception $e)
 
 1946                        $ilLog->write(
"EXCEPTION: Could not delete additional table data of question $question_id: $e");
 
 1953                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE question_fi = %s", 
 
 1958                catch (Exception $e)
 
 1960                        $ilLog->write(
"EXCEPTION: Could not delete delete question $question_id from a test: $e");
 
 1967                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM qpl_sol_sug WHERE question_fi = %s", 
 
 1972                catch (Exception $e)
 
 1974                        $ilLog->write(
"EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
 
 1980                        $directory = CLIENT_WEB_DIR . 
"/assessment/" . 
$obj_id . 
"/$question_id";
 
 1981                        if (preg_match(
"/\d+/", 
$obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory))
 
 1983                                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1987                catch (Exception $e)
 
 1989                        $ilLog->write(
"EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
 
 1995                        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2001                        foreach(
$mobs as $mob)
 
 2011                catch (Exception $e)
 
 2013                        $ilLog->write(
"EXCEPTION: Error deleting the media objects of question $question_id: $e");
 
 2017                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 2020                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
 
 2023                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
 
 2025                $assignmentList->setParentObjId(
$obj_id);
 
 2026                $assignmentList->setQuestionIdFilter($question_id);
 
 2027                $assignmentList->loadFromDb();
 
 2028                foreach($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment)
 
 2031                        $assignment->deleteFromDb();
 
 2039                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 2042                catch (Exception $e)
 
 2044                        $ilLog->write(
"EXCEPTION: Error updating the question pool question count of question pool " . $this->
getObjId() . 
" when deleting question $question_id: $e");
 
 2055                require_once 
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
 
 2056                require_once 
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
 
 2059                foreach($taxIds as $taxId)
 
 2062                        $taxNodeAssignment->deleteAssignmentsOfItem($this->
getId());
 
 2085                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
 
 2086                        array(
'integer',
'integer'),
 
 2087                        array($a_q_id, $a_q_id)
 
 2093                $found_id = array();
 
 2096                        array_push($found_id, 
$row[
"question_id"]);
 
 2099                $result = 
$ilDB->query(
"SELECT * FROM tst_test_result WHERE " . 
$ilDB->in(
'question_fi', $found_id, 
false, 
'integer'));
 
 2114                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
 
 2115                        array(
'integer',
'integer'),
 
 2116                        array($a_q_id, $a_q_id)
 
 2122                $found_id = array();
 
 2125                        array_push($found_id, 
$row[
"question_id"]);
 
 2127                $result = 
$ilDB->query(
"SELECT * FROM tst_test_result WHERE " . 
$ilDB->in(
'question_fi', $found_id, 
false, 
'integer'));
 
 2131                        $reached = 
$row[
"points"]; 
 
 2132                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 2134                        array_push($answers, array(
"reached" => $reached, 
"max" => $max));
 
 2138                foreach ($answers as $key => $value)
 
 2140                        $max += $value[
"max"];
 
 2141                        $reached += $value[
"reached"];
 
 2145                        return $reached / $max;
 
 2161                $result = 
$ilDB->queryF(
"SELECT title FROM qpl_questions WHERE question_id = %s",
 
 2168                        return $row[
"title"];
 
 2184                $result = 
$ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 2191                        return $row[
"question_text"];
 
 2201                if( !file_exists(
$file) )
 
 2206                if( !is_file(
$file) )
 
 2211                if( !is_readable(
$file) )
 
 2221                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2223                foreach (
$mobs as $mob)
 
 2231                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2233                foreach (
$mobs as $mob)
 
 2246                include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 2248                $this->page->setId($this->
getId());
 
 2249                $this->page->setParentId($qpl_id);
 
 2250                $this->page->setXMLContent(
"<PageObject><PageContent>".
 
 2251                        "<Question QRef=\"il__qst_".$this->
getId().
"\"/>".
 
 2252                        "</PageContent></PageObject>");
 
 2253                $this->page->create();
 
 2260                        include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 2263                        $xml = str_replace(
"il__qst_".$a_q_id, 
"il__qst_".$this->
id, 
$page->getXMLContent());
 
 2264                        $this->page->setXMLContent($xml);
 
 2265                        $this->page->updateFromXML();
 
 2271                include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 2273                return $page->getXMLContent();
 
 2287                if ($question_id < 1) 
return "";
 
 2288                $result = 
$ilDB->queryF(
"SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 2295                        return $data[
"type_tag"];
 
 2314                if ($question_id < 1) 
return "";
 
 2316                $result = 
$ilDB->queryF(
"SELECT title FROM qpl_questions WHERE qpl_questions.question_id = %s",
 
 2323                        return $data[
"title"];
 
 2342                'ok.svg' => 
'ok.png', 
'not_ok.svg' => 
'not_ok.png',
 
 2343                'checkbox_checked.svg' => 
'checkbox_checked.png',
 
 2344                'checkbox_unchecked.svg' => 
'checkbox_unchecked.png',
 
 2345                'radiobutton_checked.svg' => 
'radiobutton_checked.png',
 
 2346                'radiobutton_unchecked.svg' => 
'radiobutton_unchecked.png' 
 2351                $needles = array_keys(self::$imageSourceFixReplaceMap);
 
 2352                $replacements = array_values(self::$imageSourceFixReplaceMap);
 
 2353                return str_replace($needles, $replacements, $imageFilenameContainingString);
 
 2360                if( preg_match_all(
'/src="(.*?)"/m', 
$html, $matches) )
 
 2362                        $sources = $matches[1];
 
 2364                        $needleReplacementMap = array();
 
 2366                        foreach($sources as $src)
 
 2370                                if( file_exists(
$file) )
 
 2375                                $levels = explode(DIRECTORY_SEPARATOR, $src);
 
 2376                                if( count($levels) < 5 || $levels[0] != 
'Customizing' || $levels[2] != 
'skin' )
 
 2383                                if( $levels[4] == 
'Modules' || $levels[4] == 
'Services' )
 
 2385                                        $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
 
 2391                        if( count($needleReplacementMap) )
 
 2393                                $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), 
$html);
 
 2411                        "SELECT external_id FROM qpl_questions WHERE question_id = %s",
 
 2418                        $this->external_id = 
$data[
'external_id'];
 
 2421                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
 
 2423                        array($this->
getId())
 
 2425                $this->suggested_solutions = array();
 
 2428                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 2432                                $this->suggested_solutions[
$row[
"subquestion_index"]] = array(
 
 2433                                        "type" => 
$row[
"type"],
 
 2435                                        "internal_link" => 
$row[
"internal_link"],
 
 2436                                        "import_id" => 
$row[
"import_id"]
 
 2454                $estw_time = sprintf(
"%02d:%02d:%02d", $estw_time[
'h'], $estw_time[
'm'], $estw_time[
's']);
 
 2468                        $next_id = 
$ilDB->nextId(
'qpl_questions');
 
 2469                        $affectedRows = 
$ilDB->insert(
"qpl_questions", array(
 
 2470                                "question_id" => array(
"integer", $next_id),
 
 2472                                "obj_fi" => array(
"integer", 
$obj_id),
 
 2473                                "title" => array(
"text", NULL),
 
 2474                                "description" => array(
"text", NULL),
 
 2475                                "author" => array(
"text", $this->
getAuthor()),
 
 2476                                "owner" => array(
"integer", 
$ilUser->getId()),
 
 2477                                "question_text" => array(
"clob", NULL),
 
 2478                                "points" => array(
"float", 0),
 
 2480                                "working_time" => array(
"text", $estw_time),
 
 2481                                "complete" => array(
"text", $complete),
 
 2482                                "created" => array(
"integer", time()),
 
 2483                                "original_id" => array(
"integer", NULL),
 
 2484                                "tstamp" => array(
"integer", $tstamp),
 
 2488                        $this->
setId($next_id);
 
 2499                return $this->
getId();
 
 2507                $estw_time = sprintf(
"%02d:%02d:%02d", $estw_time[
'h'], $estw_time[
'm'], $estw_time[
's']);
 
 2510                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 2511                if ($this->
getId() == -1)
 
 2514                        $next_id = 
$ilDB->nextId(
'qpl_questions');
 
 2515                        $affectedRows = 
$ilDB->insert(
"qpl_questions", array(
 
 2516                                "question_id" => array(
"integer", $next_id),
 
 2518                                "obj_fi" => array(
"integer", $this->
getObjId()),
 
 2519                                "title" => array(
"text", $this->
getTitle()),
 
 2520                                "description" => array(
"text", $this->
getComment()),
 
 2521                                "author" => array(
"text", $this->
getAuthor()),
 
 2522                                "owner" => array(
"integer", $this->
getOwner()),
 
 2525                                "working_time" => array(
"text", $estw_time),
 
 2526                                "nr_of_tries" => array(
"integer", $this->
getNrOfTries()),
 
 2527                                "created" => array(
"integer", time()),
 
 2529                                "tstamp" => array(
"integer", time()),
 
 2533                        $this->
setId($next_id);
 
 2540                        $affectedRows = 
$ilDB->update(
"qpl_questions", array(
 
 2541                                "obj_fi" => array(
"integer", $this->
getObjId()),
 
 2542                                "title" => array(
"text", $this->
getTitle()),
 
 2543                                "description" => array(
"text", $this->
getComment()),
 
 2544                                "author" => array(
"text", $this->
getAuthor()),
 
 2547                                "nr_of_tries" => array(
"integer", $this->
getNrOfTries()),
 
 2548                                "working_time" => array(
"text", $estw_time),
 
 2549                                "tstamp" => array(
"integer", time()),
 
 2550                                'complete' => array(
'integer', $this->
isComplete()),
 
 2553                        "question_id" => array(
"integer", $this->
getId())
 
 2568                $this->updateSuggestedSolutions();
 
 2580                $affectedRows = 
$ilDB->manipulateF(
"UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s",
 
 2581                        array(
'integer',
'integer', 
'integer',
'text'),
 
 2582                        array(time(), ($this->
getOwner() <= 0) ? $this->
ilias->account->id : $this->getOwner(), $complete, $this->getId())
 
 2586                include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 2594            $ilDB->manipulateF(
"UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s",
 
 2595                    array(
'integer',
'integer', 
'text'),
 
 2596                    array(time(), $newId, $this->
getId())
 
 2603        protected function onDuplicate($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 
 2608                $this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
 
 2625                $this->feedbackOBJ->syncFeedback($origQuestionId, $dupQuestionId);
 
 2631        protected function onCopy($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 
 2636                $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
 
 2652                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM qpl_sol_sug WHERE question_fi = %s",
 
 2654                        array($this->
getId())
 
 2657                include_once 
"./Services/Link/classes/class.ilInternalLink.php";
 
 2659                $this->suggested_solutions = array();
 
 2672                if (array_key_exists($subquestion_index, $this->suggested_solutions))
 
 2674                        return $this->suggested_solutions[$subquestion_index];
 
 2692                if (array_key_exists($subquestion_index, $this->suggested_solutions))
 
 2694                        $title = $this->suggested_solutions[$subquestion_index][
"internal_link"];
 
 2715                if (strcmp($solution_id, 
"") != 0)
 
 2720                                $import_id = $solution_id;
 
 2723                        $this->suggested_solutions[$subquestion_index] = array(
 
 2724                                "internal_link" => $solution_id,
 
 2725                                "import_id" => $import_id
 
 2737                foreach ($this->suggested_solutions as $index => $solution)
 
 2739                        if (strcmp($solution[
"type"], 
"file") == 0)
 
 2742                                $filepath_original = str_replace(
 
 2743                                        "/{$this->obj_id}/{$this->id}/solution",
 
 2744                                        "/$parent_id/$question_id/solution",
 
 2747                                if (!file_exists($filepath))
 
 2756                                                $ilLog->write(
"File could not be duplicated!!!!", 
$ilLog->ERROR);
 
 2757                                                $ilLog->write(
"object: " . print_r($this, TRUE), 
$ilLog->ERROR);
 
 2772                $filepath_original = str_replace(
"/$this->id/solution", 
"/$original_id/solution", $filepath);
 
 2774                foreach ($this->suggested_solutions as $index => $solution)
 
 2776                        if (strcmp($solution[
"type"], 
"file") == 0)
 
 2778                                if (!file_exists($filepath_original))
 
 2787                                                $ilLog->write(
"File could not be duplicated!!!!", 
$ilLog->ERROR);
 
 2788                                                $ilLog->write(
"object: " . print_r($this, TRUE), 
$ilLog->ERROR);
 
 2799                foreach ($this->suggested_solutions as $index => $solution)
 
 2801                        if (strcmp($solution[
"type"], 
"file") == 0)
 
 2804                                $filepath_original = str_replace(
"/$this->obj_id/$this->id/solution", 
"/$source_questionpool_id/$source_question_id/solution", $filepath);
 
 2805                                if (!file_exists($filepath))
 
 2814                                                $ilLog->write(
"File could not be copied!!!!", 
$ilLog->ERROR);
 
 2815                                                $ilLog->write(
"object: " . print_r($this, TRUE), 
$ilLog->ERROR);
 
 2825        public function updateSuggestedSolutions(
$original_id = 
"")
 
 2830                include_once 
"./Services/Link/classes/class.ilInternalLink.php";
 
 2831                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM qpl_sol_sug WHERE question_fi = %s",
 
 2836                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 2837                foreach ($this->suggested_solutions as $index => $solution)
 
 2839                        $next_id = 
$ilDB->nextId(
'qpl_sol_sug');
 
 2841                        $ilDB->insert(
'qpl_sol_sug', array(
 
 2842                                                                                   'suggested_solution_id'      => array( 
'integer',    $next_id ),
 
 2843                                                                                   'question_fi'                        => array( 
'integer',    
$id ),
 
 2844                                                                                   'type'                                       => array( 
'text',               $solution[
'type'] ),
 
 2846                                                                                   'internal_link'                      => array( 
'text',               $solution[
'internal_link'] ),
 
 2847                                                                                   'import_id'                          => array( 
'text',               
null ),
 
 2848                                                                                   'subquestion_index'          => array( 
'integer',    $index ),
 
 2849                                                                                   'tstamp'                             => array( 
'integer',    time() ),
 
 2852                        if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches))
 
 2870        function saveSuggestedSolution($type, $solution_id = 
"", $subquestion_index = 0, $value = 
"")
 
 2874                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s", 
 
 2875                        array(
"integer", 
"integer"),
 
 2882                $next_id = 
$ilDB->nextId(
'qpl_sol_sug');
 
 2883                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 2885                $affectedRows = 
$ilDB->insert(
'qpl_sol_sug', array(
 
 2886                                                                                                           'suggested_solution_id'      => array( 
'integer',    $next_id ),
 
 2887                                                                                                           'question_fi'                        => array( 
'integer',    $this->
getId() ),
 
 2888                                                                                                           'type'                                       => array( 
'text',               $type ),
 
 2890                                                                                                           'internal_link'                      => array( 
'text',               $solution_id ),
 
 2891                                                                                                           'import_id'                          => array( 
'text',               
null ),
 
 2892                                                                                                           'subquestion_index'          => array( 
'integer',    $subquestion_index ),
 
 2893                                                                                                           'tstamp'                                     => array( 
'integer',    time() ),
 
 2896                if ($affectedRows == 1)
 
 2898                        $this->suggested_solutions[$subquestion_index] = array(
 
 2901                                "internal_link" => $solution_id,
 
 2910                if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
 
 2912                        include_once 
"./Services/Link/classes/class.ilInternalLink.php";
 
 2913                        include_once 
"./Modules/LearningModule/classes/class.ilLMObject.php";
 
 2914                        include_once 
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
 
 2915                        switch ($matches[2])
 
 2933                        if (strcmp($resolved_link, 
"") == 0)
 
 2935                                $resolved_link = $internal_link;
 
 2940                        $resolved_link = $internal_link;
 
 2942                return $resolved_link;
 
 2949                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
 
 2957                                $internal_link = 
$row[
"internal_link"];
 
 2958                                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 2960                                if (strcmp($internal_link, $resolved_link) != 0)
 
 2963                                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
 
 2964                                                array(
'text',
'integer'),
 
 2965                                                array($resolved_link, 
$row[
"suggested_solution_id"])
 
 2976                        include_once 
"./Services/Link/classes/class.ilInternalLink.php";
 
 2979                        $result = 
$ilDB->queryF(
"SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
 
 2987                                        if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", 
$row[
"internal_link"], $matches))
 
 3000                        "lm" => 
"LearningModule",
 
 3001                        "pg" => 
"PageObject",
 
 3002                        "st" => 
"StructureObject",
 
 3003                        "git" => 
"GlossaryItem",
 
 3004                        "mob" => 
"MediaObject" 
 3007                if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches))
 
 3009                        $type = $matches[1];
 
 3011                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 3012                        switch($linktypes[$matches[1]])
 
 3014                                case "LearningModule":
 
 3015                                        $href = 
"./goto.php?target=" . $type . 
"_" . 
$target_id;
 
 3018                                case "StructureObject":
 
 3019                                        $href = 
"./goto.php?target=" . $type . 
"_" . 
$target_id;
 
 3021                                case "GlossaryItem":
 
 3022                                        $href = 
"./goto.php?target=" . $type . 
"_" . 
$target_id;
 
 3025                                        $href = 
"./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . 
"&cmd=media&ref_id=".$_GET[
"ref_id"].
"&mob_id=".
$target_id;
 
 3042                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_questions WHERE question_id = %s",
 
 3049                        if (
$row[
"original_id"] > 0)
 
 3051                                return $row[
"original_id"];
 
 3055                                return $row[
"question_id"];
 
 3069                        SELECT COUNT(dupl.question_id) cnt 
 3070                        FROM qpl_questions dupl 
 3071                        INNER JOIN qpl_questions orig 
 3072                        ON orig.question_id = dupl.original_id 
 3073                        WHERE dupl.question_id = %s 
 3079                return $row[
'cnt'] > 0;
 
 3093                if ( !$originalObjId )
 
 3104                $this->
setId($original);
 
 3118                $this->updateSuggestedSolutions($original);
 
 3140                if ($question_id < 1)
 
 3145                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE question_id = %s",
 
 3170                if ($question_id < 1)
 
 3175                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions INNER JOIN object_data ON obj_fi = obj_id WHERE question_id = %s AND type = 'qpl'",
 
 3209                if (strcmp($question_id, 
"") != 0)
 
 3212                        if (!strlen($question_type)) 
return null;
 
 3233                if (strcmp($this->points, 
"") == 0)
 
 3252                $this->points = $a_points;
 
 3283                $result = 
$ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
 
 3284                        array(
'integer',
'integer'),
 
 3285                        array($active_id, $question_id)
 
 3290                        return $row[
"maxpass"];
 
 3310                if (($question_id < 1) || ($user_id < 1))
 
 3315                $result = 
$ilDB->queryF(
"SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
 
 3322                        $qpl_object_id = 
$row[
"obj_fi"];
 
 3323                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 3342                if ($question_id < 1) 
return 0;
 
 3343                $result = 
$ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s",
 
 3393                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 3395                if ($count_system == 1)
 
 3403                if ($score_cutting == 0)
 
 3432                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 3435                $result = 
$ilDB->queryF(
"SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 3436                        array(
'integer',
'integer',
'integer'),
 
 3437                        array($active_id, $question_id, 
$pass)
 
 3460                $res = 
$ilDB->queryF(
"SELECT DISTINCT(question_fi) FROM tst_test_result JOIN tst_active ".
 
 3461                        "ON (active_id = active_fi) ".
 
 3462                        "WHERE " . 
$ilDB->in(
'question_fi', $a_question_ids, 
false, 
'integer') .
 
 3463                        " AND user_fi = %s",
 
 3467                return (
$res->numRows() == count($a_question_ids)) ? true : 
false;
 
 3491                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 3505                for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
 
 3507                        $material = $a_material->getMaterial($i);
 
 3508                        if (strcmp($material[
"type"], 
"mattext") == 0)
 
 3510                                $result .= $material[
"material"]->getContent();
 
 3512                        if (strcmp($material[
"type"], 
"matimage") == 0)
 
 3514                                $matimage = $material[
"material"];
 
 3515                                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
 
 3518                                        if (!is_array(
$_SESSION[
"import_mob_xhtml"])) 
$_SESSION[
"import_mob_xhtml"] = array();
 
 3519                                        array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 3534        function addQTIMaterial(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE)
 
 3536                include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 3537                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 3539                $a_xml_writer->xmlStartTag(
"material");
 
 3541                        "texttype" => 
"text/plain" 
 3543                if ($this->
isHTML($a_material))
 
 3545                        $attrs[
"texttype"] = 
"text/xhtml";
 
 3551                        foreach (
$mobs as $mob)
 
 3553                                $moblabel = 
"il_" . IL_INST_ID . 
"_mob_" . $mob;
 
 3554                                if (strpos($a_material, 
"mm_$mob") !== FALSE)
 
 3560                                                        "label" => $moblabel,
 
 3561                                                        "uri" => 
"objects/" . 
"il_" . IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 3564                                        $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
 
 3568                if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
 
 3575                if (preg_match(
"/.*\.(png|jpg|gif|jpeg)$/i", $image_filename, $matches))
 
 3577                        $extension = 
"." . $matches[1];
 
 3582                        $image_filename = uniqid($image_filename.microtime(
true));
 
 3585                $image_filename = md5($image_filename) . $extension;
 
 3587                return $image_filename;
 
 3613                        $result = 
$ilDB->queryF(
"SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 3614                                array(
'integer',
'integer',
'integer'),
 
 3615                                array($active_id, $question_id, 
$pass)
 
 3617                        $manual = ($manualscoring) ? 1 : 0;
 
 3618                        $rowsnum = 
$result->numRows();
 
 3622                                $old_points = 
$row[
"points"];
 
 3625                                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 3626                                                array(
'float', 
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 3627                                                array(
$points, $manual, time(), $active_id, $question_id, 
$pass)
 
 3633                                $next_id = 
$ilDB->nextId(
'tst_test_result');
 
 3634                                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
 
 3635                                        array(
'integer', 
'integer',
'integer', 
'float', 
'integer', 
'integer',
'integer'),
 
 3636                                        array($next_id, $active_id, $question_id, 
$points, 
$pass, $manual, time())
 
 3640                        if(self::isForcePassResultUpdateEnabled() || $old_points != 
$points || !$rowsnum)
 
 3642                                assQuestion::_updateTestPassResults($active_id, 
$pass, $obligationsEnabled);
 
 3644                                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 3645                                include_once 
'./Modules/Course/classes/class.ilCourseObjectiveResult.php';
 
 3648                                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3652                                        include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 3709                $result = 
$ilDB->queryF(
"SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
 
 3716                        return $row[
"question_type_id"];
 
 3721        public function syncHints()
 
 3726                $ilDB->manipulateF(
"DELETE FROM qpl_hints WHERE qht_question_fi = %s",
 
 3728                        array($this->original_id)
 
 3732                $result = 
$ilDB->queryF(
"SELECT * FROM qpl_hints WHERE qht_question_fi = %s",
 
 3734                        array($this->
getId())
 
 3742                                $next_id = 
$ilDB->nextId(
'qpl_hints');
 
 3744                                $ilDB->insert(
'qpl_hints', array(
 
 3745                                                'qht_hint_id'     => array(
'integer', $next_id),
 
 3746                                                'qht_question_fi' => array(
'integer', $this->original_id),
 
 3747                                                'qht_hint_index'  => array(
'integer', 
$row[
"qht_hint_index"]),
 
 3748                                                'qht_hint_points' => array(
'integer', 
$row[
"qht_hint_points"]),
 
 3749                                                'qht_hint_text'   => array(
'text', 
$row[
"qht_hint_text"]),
 
 3765                $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->
getId(), 
false);
 
 3766                $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->
getId(), 
true);
 
 3767                $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->
getId());
 
 3769                foreach ($this->suggested_solutions as $solution_array)
 
 3771                        $collected .= $solution_array[
"value"];
 
 3774                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
 
 3776                foreach($questionHintList as $questionHint)
 
 3779                        $collected .= $questionHint->getText();
 
 3792                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 3805                $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id = %s",
 
 3807                        array($this->
getId())
 
 3809                $instances = array();
 
 3813                        array_push($ids, 
$row[
"question_id"]);
 
 3815                foreach ($ids as $question_id)
 
 3818                        $result = 
$ilDB->queryF(
"SELECT tst_tests.obj_fi FROM tst_tests, tst_test_question WHERE tst_test_question.question_fi = %s AND tst_test_question.test_fi = tst_tests.test_id",
 
 3827                        $result = 
$ilDB->queryF(
"SELECT tst_tests.obj_fi FROM tst_tests, tst_test_rnd_qst, tst_active WHERE tst_test_rnd_qst.active_fi = tst_active.active_id AND tst_test_rnd_qst.question_fi = %s AND tst_tests.test_id = tst_active.test_fi",
 
 3836                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 3837                foreach ($instances as $key => $value)
 
 3846                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 3849                if (in_array($questiontype, $scoring))
 
 3869                $result = 
$ilDB->queryF(
"SELECT * FROM tst_active WHERE active_id = %s",
 
 3876                        return array(
"user_id" => 
$row[
"user_fi"], 
"test_id" => 
$row[
"test_fi"]);
 
 3893                if( self::isCoreQuestionType($question_type) )
 
 3905                return $questionType.
'GUI';
 
 3910                return $questionType;
 
 3915                return str_replace(
'ass', 
'ilAss', $questionType).
'Feedback';
 
 3921                return file_exists(
"Modules/TestQuestionPool/classes/class.{$guiClassName}.php");
 
 3929                        require_once 
"Modules/TestQuestionPool/classes/class.{$guiClassName}.php";
 
 3936                        require_once 
"Modules/TestQuestionPool/classes/class.{$objectClassName}.php";
 
 3940                require_once 
"Modules/TestQuestionPool/classes/feedback/class.{$feedbackClassName}.php";
 
 3945                global $ilPluginAdmin;
 
 3948                        self::getObjectClassNameByQuestionType($questionType),
 
 3949                        self::getFeedbackClassNameByQuestionType($questionType)
 
 3957                $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 3958                foreach ($pl_names as $pl_name)
 
 3961                        if (strcmp($pl->getQuestionType(), $questionType) == 0)
 
 3963                                foreach($classes as $class)
 
 3965                                        $pl->includeClass(
"class.{$class}.php");
 
 3981                if (file_exists(
"./Modules/TestQuestionPool/classes/class.".$type_tag.
".php"))
 
 3984                        return $lng->txt($type_tag);
 
 3988                        global $ilPluginAdmin;
 
 3989                        $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 3990                        foreach ($pl_names as $pl_name)
 
 3993                                if (strcmp($pl->getQuestionType(), $type_tag) == 0)
 
 3995                                        return $pl->getQuestionTypeTranslation();
 
 4027                if (strcmp($a_question_id, 
"") != 0)
 
 4034                        $question_gui = 
new $question_type_gui();
 
 4035                        $question_gui->object->loadFromDb($a_question_id);
 
 4038                        $question_gui->object->feedbackOBJ = 
new $feedbackObjectClassname($question_gui->object, 
$ilCtrl, 
$ilDB, 
$lng);
 
 4040                        $assSettings = 
new ilSetting(
'assessment');
 
 4041                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 4043                        $processLockerFactory->setQuestionId($question_gui->object->getId());
 
 4044                        $processLockerFactory->setUserId(
$ilUser->getId());
 
 4045                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 4047                        $question_gui->object->setProcessLocker($processLockerFactory->getLocker());
 
 4052                        $ilLog->write(
'Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', 
$ilLog->WARNING);
 
 4055                return $question_gui;
 
 4083                                return $this->
getId();
 
 4103                        case "est_working_time":
 
 4127                        case "suggested_solutions":
 
 4134                                if (array_key_exists($value, $this->arrData))
 
 4136                                        return $this->arrData[$value];
 
 4154                                $this->
setId($value);
 
 4174                        case "est_working_time":
 
 4175                                if (is_array($value))
 
 4196                                $this->page =& $value;
 
 4199                                $this->arrData[$key] = $value;
 
 4211                $this->nr_of_tries = $a_nr_of_tries;
 
 4216                $this->export_image_path = (string)$a_path;
 
 4223                if ($question_id < 1)
 
 4228                $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
 
 4229                        array(
'integer', 
'integer'),
 
 4262                $this->prevent_rte_usage = $a_val;
 
 4284                $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->
getId());
 
 4310                $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
 
 4330                $this->defaultnroftries = $a_defaultnroftries;
 
 4354                $query = 
"SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
 
 4356                $res = 
$ilDB->queryF(
$query, array(
'integer'), array((
int)$questionId));
 
 4359                return $row[
'obj_fi'];
 
 4379                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
 
 4384                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssHintPage.php';
 
 4386                        foreach($hintIds as $originalHintId => $duplicateHintId)
 
 4389                                $originalXML = $originalPageObject->getXMLContent();
 
 4392                                $duplicatePageObject->setId($duplicateHintId);
 
 4393                                $duplicatePageObject->setParentId($this->
getId());
 
 4394                                $duplicatePageObject->setXMLContent($originalXML);                              
 
 4395                                $duplicatePageObject->createFromXML();
 
 4404                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
 
 4406                $assignmentList->setParentObjId($srcParentId);
 
 4407                $assignmentList->setQuestionIdFilter($srcQuestionId);
 
 4408                $assignmentList->loadFromDb();
 
 4410                foreach($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment)
 
 4414                        $assignment->setParentObjId($trgParentId);
 
 4415                        $assignment->setQuestionId($trgQuestionId);
 
 4416                        $assignment->saveToDb();
 
 4424                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
 
 4426                $assignmentList->setParentObjId($trgParentId);
 
 4427                $assignmentList->setQuestionIdFilter($trgQuestionId);
 
 4428                $assignmentList->loadFromDb();
 
 4430                foreach($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment)
 
 4434                        $assignment->deleteFromDb();
 
 4496                        SELECT          count(active_fi) cnt 
 4500                        WHERE           active_fi = %s 
 4501                        AND                     question_fi = %s 
 4506                        $query, array(
'integer',
'integer',
'integer'),
 
 4507                        array($activeId, $questionId, 
$pass)
 
 4512                return (
int)
$row[
'cnt'];
 
 4536                        require_once 
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
 
 4580                        self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
 
 4581                        self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
 
 4590                $this->questionChangeListeners[] = $listener;
 
 4605                        $listener->notifyQuestionCreated($this);
 
 4613                        $listener->notifyQuestionEdited($this);
 
 4621                        $listener->notifyQuestionDeleted($this);
 
 4630                require_once 
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
 
 4639                require_once 
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
 
 4646                        SELECT          qpl_questions.*, 
 4647                                                {$this->getAdditionalTableName()}.* 
 4649                        LEFT JOIN       {$this->getAdditionalTableName()} 
 4650                        ON                      {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id 
 4651                        WHERE                   qpl_questions.question_id = %s 
 4684                                WHERE active_fi = %s 
 4685                                AND question_fi = %s 
 4691                        return $ilDB->queryF(
$query, array(
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 4692                                array($active_id, $this->
getId(), $pass, $this->
getStep(), (
int)$authorized)
 
 4700                                WHERE active_fi = %s 
 4701                                AND question_fi = %s 
 4706                        return $ilDB->queryF(
$query, array(
'integer', 
'integer', 
'integer', 
'integer'),
 
 4707                                array($active_id, $this->
getId(), $pass, (
int)$authorized)
 
 4723                return $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE solution_id = %s",
 
 4724                        array(
'integer'), array($solutionId)
 
 4755                if(count($ignoredSolutionIds) > 0)
 
 4757                        $not_in = 
' AND ' . 
$ilDB->in(
'solution_id', $ignoredSolutionIds, 
true, 
'integer') . 
' ';
 
 4763                                DELETE FROM tst_solutions 
 4764                                WHERE active_fi = %s 
 4765                                AND question_fi = %s 
 4772                        return $ilDB->manipulateF(
$query, array(
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 4773                                array($active_id, $this->
getId(), $pass, $this->
getStep(), (
int)$authorized)
 
 4779                                DELETE FROM tst_solutions 
 4780                                WHERE active_fi = %s 
 4781                                AND question_fi = %s 
 4787                        return $ilDB->manipulateF(
$query, array(
'integer', 
'integer', 
'integer', 
'integer'),
 
 4788                                array($active_id, $this->
getId(), $pass, (
int)$authorized)
 
 4807                $next_id = 
$ilDB->nextId(
"tst_solutions");
 
 4810                        "solution_id" => array(
"integer", $next_id),
 
 4811                        "active_fi" => array(
"integer", $active_id),
 
 4812                        "question_fi" => array(
"integer", $this->
getId()),
 
 4813                        "value1" => array(
"clob", $value1),
 
 4814                        "value2" => array(
"clob", $value2),
 
 4815                        "pass" => array(
"integer", 
$pass),
 
 4816                        "tstamp" => array(
"integer", time()),
 
 4817                        'authorized' => array(
'integer', (
int)$authorized)
 
 4820                if( $this->
getStep() !== 
null )
 
 4822                        $fieldData[
'step'] = array(
"integer", $this->
getStep());
 
 4825                return $ilDB->insert(
"tst_solutions", $fieldData);
 
 4843                        "value1" => array(
"clob", $value1),
 
 4844                        "value2" => array(
"clob", $value2),
 
 4845                        "tstamp" => array(
"integer", time()),
 
 4846                        'authorized' => array(
'integer', (
int)$authorized)
 
 4849                if( $this->
getStep() !== 
null )
 
 4851                        $fieldData[
'step'] = array(
"integer", $this->
getStep());
 
 4854                return $ilDB->update(
"tst_solutions", $fieldData, array(
 
 4855                        'solution_id' => array(
'integer', $solutionId)
 
 4864                        'tstamp' => array(
'integer', time()),
 
 4865                        'authorized' => array(
'integer', (
int)$authorized)
 
 4869                        'question_fi' => array(
'integer', $this->
getId()),
 
 4870                        'active_fi' => array(
'integer', $activeId),
 
 4871                        'pass' => array(
'integer', 
$pass)
 
 4874                return $ilDB->update(
'tst_solutions', $fieldData, $whereData);
 
 4899                $this->step = 
$step;
 
 4919                return gmdate(
'H:i:s', $time);
 
 4929                $time_array = explode(
':',$time);
 
 4930                if(     
sizeof($time_array) == 3)
 
 4932                        $sec += $time_array[0] * 3600;
 
 4933                        $sec += $time_array[1] * 60;
 
 4934                        $sec += $time_array[2];
 
 4944                require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
 
 4945                return new \ilAssSelfAssessmentQuestionFormatter();
 
 4950                return json_encode(array());
 
 4959                return (
bool)$solutionAvailability[
'authorized'];
 
 4964                return (
bool)$solutionAvailability[
'authorized'] || (bool)$solutionAvailability[
'intermediate'];
 
 4973        protected function lookupMaxStep($active_id, 
$pass)
 
 4979                        "SELECT MAX(step) max_step FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
 
 4980                        array(
"integer", 
"integer", 
"integer"), array($active_id, 
$pass, $this->
getId())
 
 4985                $maxStep = 
$row[
'max_step'];
 
 5002                        'authorized' => 
false,
 
 5003                        'intermediate' => 
false 
 5007                        SELECT authorized, COUNT(*) cnt 
 5009                        WHERE active_fi = %s 
 5010                        AND question_fi = %s 
 5014                $result = 
$ilDB->queryF(
$query, array(
'integer', 
'integer', 
'integer'), array($activeId, $this->
getId(), $pass));
 
 5018                        if (
$row[
'authorized']) {
 
 5019                                $return[
'authorized'] = 
$row[
'cnt'] > 0;
 
 5023                                $return[
'intermediate'] = 
$row[
'cnt'] > 0;
 
 5035                        DELETE FROM tst_solutions 
 5036                        WHERE active_fi = %s 
 5037                        AND question_fi = %s 
 5041                return $ilDB->manipulateF(
$query, array(
'integer', 
'integer', 
'integer'),
 
 5042                        array($activeId, $this->
getId(), $pass)
 
 5051                $this->_updateTestPassResults(
 
 5061                        DELETE FROM tst_test_result 
 5062                        WHERE active_fi = %s 
 5063                        AND question_fi = %s 
 5067                return $ilDB->manipulateF(
$query, array(
'integer', 
'integer', 
'integer'),
 
 5068                        array($activeId, $this->
getId(), $pass)
 
 5076                $IN_questionIds = 
$ilDB->in(
'question_fi', $questionIds, 
false, 
'integer');
 
 5080                        FROM tst_test_result 
 5081                        WHERE active_fi = %s 
 5087                        $query, array(
'integer', 
'integer'), array($activeId, 
$pass)
 
 5090                return $row[
'cnt'] < count($questionIds);
 
 5099                        FROM tst_test_result 
 5100                        WHERE active_fi = %s 
 5101                        AND question_fi = %s 
 5105                $row = 
$ilDB->fetchAssoc(
$ilDB->queryF(
$query, array(
'integer', 
'integer', 
'integer'), array($activeId, $questionId, 
$pass)));
 
 5107                return $row[
'cnt'] > 0;
 
 5135                $ilDB->manipulateF(
"UPDATE qpl_questions SET tstamp = %s  WHERE question_id = %s",
 
 5136                        array(
'integer', 
'integer'),
 
 5137                        array(time(), $this->
getId())
 
Abstract basic class which is to be extended by the concrete assessment question type classes.
getTotalAnswers()
get total number of answers
_getQuestionTitle($question_id)
Returns the question title of a question with a given id.
$export_image_path
(Web) Path to images
moveUploadedMediaFile($file, $name)
Move an uploaded media file to an public accessible temp dir to present it.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
static includePluginClass($questionType, $withGuiClass)
static getFeedbackClassNameByQuestionType($questionType)
setPreventRteUsage($a_val)
Set prevent rte usage.
removeResultRecord($activeId, $pass)
static _getOriginalId($question_id)
Returns the original id of a question.
$additinalContentEditingMode
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this question.
setProcessLocker($processLocker)
formatSAQuestion($a_q)
Format self assessment question.
setShuffle($shuffle=true)
Sets the shuffle flag.
setId($id=-1)
Sets the id of the assQuestion object.
keyInArray($searchkey, $array)
returns TRUE if the key occurs in an array
setOriginalId($original_id)
static _instantiateQuestion($question_id)
getQuestionTypeID()
Returns the question type of the question.
setObjId($obj_id=0)
Set the object id of the container object.
static sumTimesInISO8601FormatH_i_s_Extended($time1, $time2)
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
static isAllowedImageFileExtension($mimeType, $fileExtension)
copySuggestedSolutionFiles($source_questionpool_id, $source_question_id)
static originalQuestionExists($questionId)
beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
static isObligationPossible($questionId)
returns boolean wether it is possible to set this question type as obligatory or not considering the ...
static setForcePassResultUpdateEnabled($forcePassResultsUpdateEnabled)
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
setSuggestedSolution($solution_id="", $subquestion_index=0, $is_import=false)
Sets a suggested solution for the question.
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
saveQuestionDataToDb($original_id="")
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Receives parameters from a QTI parser and creates a valid ILIAS question object.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
syncSuggestedSolutionFiles($original_id)
Syncs the files of a suggested solution if the question is synced.
isClone($question_id="")
Checks whether the question is a clone of another question or not.
static fetchMimeTypeIdentifier($contentTypeString)
fixUnavailableSkinImageSources($html)
adjustReachedPointsByScoringOptions($points, $active_id, $pass=NULL)
Adjust the given reached points by checks for all special scoring options in the test container.
deletePageOfQuestion($question_id)
Deletes the page object of a question with a given ID.
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
_getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
savePreviewData(ilAssQuestionPreviewSession $previewSession)
Reworks the allready saved working data if neccessary.
isComplete()
Returns true, if a question is complete for use.
getHtmlQuestionContentPurifier()
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
updateCurrentSolutionsAuthorization($activeId, $pass, $authorized)
static _getSuggestedSolutionCount($question_id)
Returns the number of suggested solutions associated with a question.
isInUse($question_id="")
Checks whether the question is in use or not.
static _areAnswered($a_user_id, $a_question_ids)
Checks if an array of question ids is answered by an user or not.
isPreviewSolutionCorrect(ilAssQuestionPreviewSession $previewSession)
cleanupMediaObjectUsage()
synchronises appearances of media objects in the question with media object usage table
createNewImageFileName($image_filename, $unique=false)
_questionExistsInTest($question_id, $test_id)
getUserSolutionPreferingIntermediate($active_id, $pass=NULL)
_getReachedPoints($active_id, $question_id, $pass=NULL)
Returns the points, a learner has reached answering the question.
getId()
Gets the id of the assQuestion object.
_getQuestionText($a_q_id)
Returns question text.
_updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
@TODO Move this to a proper place.
lookupForExistingSolutions($activeId, $pass)
Lookup if an authorized or intermediate solution exists.
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
getObjId()
Get the object id of the container object.
questionTitleExists($questionpool_id, $title)
Returns TRUE if the question title exists in the database.
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
persistWorkingState($active_id, $pass=NULL, $obligationsEnabled=false, $authorized=true)
persists the working state for current testactive and testpass
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
_getInternalLinkHref($target="")
getSuggestedSolutionPath()
Returns the path for a suggested solution.
removeExistingSolutions($activeId, $pass)
areObligationsToBeConsidered()
setTitle($title="")
Sets the title string of the assQuestion object.
getOwner()
Gets the creator/owner ID of the assQuestion object.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
isHTML($a_text)
Checks if a given string contains HTML or not.
setObligationsToBeConsidered($obligationsToBeConsidered)
persistPreviewState(ilAssQuestionPreviewSession $previewSession)
persists the preview state for current user and question
static $forcePassResultsUpdateEnabled
addQuestionChangeListener(ilQuestionChangeListener $listener)
syncXHTMLMediaObjectsOfQuestion()
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
onCopy($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
Will be called when a question is copied (into another question pool)
authorizedOrIntermediateSolutionExists($active_id, $pass)
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
resetUsersAnswer($activeId, $pass)
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
getJavaPath()
Returns the image path for web accessable images of a question.
createNewQuestion($a_create_page=true)
Creates a new question without an owner when a new question is created This assures that an ID is giv...
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator)
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
getHtmlUserSolutionPurifier()
getSuggestedSolutionTitle($subquestion_index=0)
Returns the title of a suggested solution at a given subquestion_index.
static getObjectClassNameByQuestionType($questionType)
setExportImagePath($a_path)
isValidAdditionalContentEditingMode($additionalContentEditingMode)
returns the fact wether the passed additional content mode is valid or not
toXML($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
Returns a QTI xml representation of the question.
setEstimatedWorkingTimeFromDurationString($durationString)
Sets the estimated working time of a question from a given datetime string.
getSuggestedSolutionPathWeb()
Returns the web path for a suggested solution.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
buildImagePath($questionId, $parentObjectId)
addQTIMaterial(&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
Creates a QTI material tag from a plain text or xhtml text.
getFlashPath()
Returns the image path for web accessable flash files of a question.
__get($value)
Object getter.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
getSuggestedSolution($subquestion_index=0)
Returns a suggested solution for a given subquestion index.
$obligationsToBeConsidered
_isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
updateCurrentSolution($solutionId, $value1, $value2, $authorized=true)
removeSolutionRecordById($solutionId)
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...
static convertISO8601FormatH_i_s_ExtendedToSeconds($time)
duplicateSuggestedSolutionFiles($parent_id, $question_id)
Duplicates the files of a suggested solution if the question is duplicated.
setAuthor($author="")
Sets the authors name of the assQuestion object.
$arrData
Associative array to store properties.
static isFileAvailable($file)
getQuestionType()
Returns the question type of the question.
deleteSuggestedSolutions()
Deletes all suggestes solutions in the database.
getPoints()
Returns the maximum available points for the question.
getOutputType()
Gets the output type.
static isCoreQuestionType($questionType)
_setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
Sets the points, a learner has reached answering the question Additionally objective results are upda...
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getActiveUserData($active_id)
Returns the user id and the test id for a given active id.
setExternalId($external_id)
getValidAdditionalContentEditingModes()
getter for valid additional content editing modes
deleteTaxonomyAssignments()
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
getQuestionChangeListeners()
_getTotalAnswers($a_q_id)
get number of answers for question id (static) note: do not use $this inside this method
authorizedSolutionExists($active_id, $pass)
getJavaPathWeb()
Returns the web image path for web accessable java applets of a question.
onDuplicate($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
Will be called when a question is duplicated (inside a question pool or for insertion in a test)
getTestId()
Gets the test id of the assQuestion object.
setShuffler(ilArrayElementShuffler $shuffler)
__set($key, $value)
Object setter.
calculateResultsFromSolution($active_id, $pass=NULL, $obligationsEnabled=false)
Calculates the question results from a previously saved question solution.
removeIntermediateSolution($active_id, $pass)
_resolveIntLinks($question_id)
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
getSelfAssessmentEditingMode()
Get Self-Assessment Editing Mode.
static $allowedCharsetsByMimeType
copyPageOfQuestion($a_q_id)
static isForcePassResultUpdateEnabled()
static lookupOriginalParentObjId($originalQuestionId)
returns the parent object id for given original question id (should be a qpl id, but theoretically it...
_resolveInternalLink($internal_link)
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
_questionExistsInPool($question_id)
Returns true if the question already exists in the database and is assigned to a question pool.
setOutputType($outputType=OUTPUT_HTML)
Sets the output type.
static lookupParentObjId($questionId)
@global ilDB $ilDB
static _getTotalRightAnswers($a_q_id)
get number of answers for question id (static) note: do not use $this inside this method
getSelfAssessmentFormatter()
static $imageSourceFixReplaceMap
static getGuiClassNameByQuestionType($questionType)
& _getQuestionInfo($question_id)
Returns question information from the database.
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
static getAllowedImageFileExtensions()
getDefaultNrOfTries()
Get Default Nr of Tries.
setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
Set Self-Assessment Editing Mode.
static $allowedFileExtensionsByMimeType
static setResultGateway($resultGateway)
getShuffle()
Gets the shuffle flag.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
getFlashPathWeb()
Returns the web image path for web accessable flash applications of a question.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
static includeCoreClass($questionType, $withGuiClass)
_needsManualScoring($question_id)
createPageObject()
create page object of question
static missingResultRecordExists($activeId, $pass, $questionIds)
copyXHTMLMediaObjectsOfQuestion($a_q_id)
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
static _isWorkedThrough($active_id, $question_id, $pass=NULL)
Returns true if the question was worked through in the given pass Worked through means that the user ...
getSuggestedSolutions()
Return the suggested solutions.
_logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
& _getSuggestedSolution($question_id, $subquestion_index=0)
Returns a suggested solution for a given subquestion index.
getAnswerTableName()
Returns the name of the answer table in the database.
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
fixSvgToPng($imageFilenameContainingString)
syncSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
_getTitle($a_q_id)
Returns the title of a question.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
$selfassessmenteditingmode
getTitle()
Gets the title string of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
duplicateQuestionHints($originalQuestionId, $duplicateQuestionId)
setComment($comment="")
Sets the comment string of the assQuestion object.
getSuggestedSolutionOutput()
getComment()
Gets the comment string of the assQuestion object.
setTestId($id=-1)
Sets the test id of the assQuestion object.
getAdjustedReachedPoints($active_id, $pass=NULL, $authorizedSolution=true)
returns the reached points ...
getAuthor()
Gets the authors name of the assQuestion object.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
setNrOfTries($a_nr_of_tries)
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assQuestion constructor
getReachedPoints($active_id, $pass=NULL)
Returns the points, a learner has reached answering the question This is the fast way to get the poin...
$nr_of_tries
Number of tries.
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
static isAllowedImageMimeType($mimeType)
isAnswered($active_id, $pass=null)
returns boolean wether the question is answered during test pass or not
saveToDb($original_id="")
Saves the question to the database.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
_questionExists($question_id)
Returns true if the question already exists in the database.
pcArrayShuffle($array)
Shuffles the values of a given array.
setQuestion($question="")
Sets the question string of the question object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
loadFromDb($question_id)
Loads the question from the database.
static getAllowedFileExtensionsForMimeType($mimeType)
static lookupResultRecordExist($activeId, $questionId, $pass)
setLastChange($lastChange)
static getResultGateway()
& getInstances()
Gets all instances of the question.
createRandomSolution($test_id, $user_id)
getEstimatedWorkingTime()
Gets the estimated working time of a question.
getQuestionTypeFromDb($question_id)
get question type for question id
getPreventRteUsage()
Get prevent rte usage.
deleteAnswers($question_id)
Deletes datasets from answers tables.
setDefaultNrOfTries($a_defaultnroftries)
Set Default Nr of Tries.
Assessment hint page object.
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
deleteRequestsByQuestionIds($questionIds)
Deletes all hint requests relating to a question included in given question ids.
getParticipantsSolution()
setParticipantsSolution($participantSolution)
_updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
_saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
_deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
_getIdForImportId($a_type, $a_target)
Get current id for an import id.
_getIdForImportId($a_import_id)
get current object id for import id (static)
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
_getLogLanguage()
retrieve the log language for assessment logging
_getManualScoringTypes()
Retrieve the manual scoring settings as type strings.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
_getParticipantData($active_id)
Retrieves a participant name from active id.
_getCountSystem($active_id)
Gets the count system for the calculation of points.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
_lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
static buildExamId($active_id, $pass, $test_obj_id=null)
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
static _getUserIdFromActiveId($active_id)
_getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
_getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
_getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table
Taxonomy node <-> item assignment.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static isHTML($a_text)
Checks if a given string contains HTML or not.
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static removeTrailingPathSeparators($path)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static createDirectory($a_dir, $a_mod=0755)
create directory
migrateToLmContent($content)
redirection script todo: (a better solution should control the processing via a xml file)
const ILIAS_ABSOLUTE_PATH