4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7 require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
8 require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
30 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
32 $this->minAutoComplete = self::MIN_LENGTH_AUTOCOMPLETE;
143 return $this->minAutoComplete ? $this->minAutoComplete : self::MIN_LENGTH_AUTOCOMPLETE;
148 if (strlen($this->title)
151 &&
sizeof($this->answers) > 0
152 &&
sizeof($this->correct_answers) > 0
174 if(
sizeof($correct_answers) == 0 ||
sizeof($hidden_text_files) == 0 )
178 if(
sizeof($correct_answers) !=
sizeof($hidden_text_files))
182 foreach($correct_answers as $key => $correct_answers_row)
188 if( !is_array($correct_answers_row[0]) ||
sizeof($correct_answers_row[0]) == 0)
192 if($correct_answers_row[1] > 0)
194 array_push(
$points, $correct_answers_row[1]);
197 if(
sizeof($correct_answers) !=
sizeof(
$points))
214 foreach($answers[0] as $key => $answer)
216 if(!in_array($answer, $answer_options))
250 array( $this->
getId() )
253 ) .
" (question_fi, long_menu_text, feedback_setting, min_auto_complete) VALUES (%s, %s, %s, %s)",
254 array(
"integer",
"text",
"integer",
"integer"),
272 foreach($gap[0] as $position => $answer)
274 if($type_array == null)
280 $type = $type_array[$gap_number];
285 'question_fi' => array(
'integer', (
int)$this->
getId()),
286 'gap_number' => array(
'integer', (
int)$gap_number),
287 'position' => array(
'integer', (
int)$position)
290 'answer_text' => array(
'text', $answer),
291 'points' => array(
'float', $gap[1]),
292 'type' => array(
'integer', (
int) $type)
305 foreach($array as $gap => $values)
308 if(is_array($values))
310 foreach($values as $key => $value)
312 $file_content .= $value .
"\n";
314 $file_content = rtrim($file_content,
"\n");
316 fwrite(
$file, $file_content);
333 foreach( $files as
$file)
335 $gap = str_replace(
'.txt',
'', basename($file));
336 $answers[(int) $gap] = explode(
"\n", file_get_contents($file));
352 throw new ilException(
'Cannot create export directory');
356 !is_dir($folder_name) ||
357 !is_readable($folder_name) ||
358 !is_writable($folder_name)
361 throw new ilException(
'Cannot create export directory');
374 $this->
setId($question_id);
383 include_once(
"./Services/RTE/classes/class.ilRTE.php");
389 if( isset(
$data[
'feedback_setting']) )
404 parent::loadFromDb($question_id);
409 $res = $this->db->queryF(
410 "SELECT * FROM {$this->getAnswerTableName()} WHERE question_fi = %s ORDER BY gap_number, position ASC",
411 array(
'integer'), array($question_id)
414 $correct_answers = array();
417 $correct_answers[
$data[
'gap_number']][0][
$data[
'position']] = rtrim($data[
'answer_text']);
418 $correct_answers[$data[
'gap_number']][1] = $data[
'points'];
419 $correct_answers[$data[
'gap_number']][2] = $data[
'type'];
428 $correct_answers = array();
429 $res = $this->db->queryF(
430 'SELECT gap_number, answer_text FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s',
431 array(
'integer'), array($question_id)
435 if(array_key_exists(
$data[
'gap_number'], $correct_answers))
437 $correct_answers[
$data[
'gap_number']] .=
' ' . $this->lng->txt(
"or") .
' ';
438 $correct_answers[
$data[
'gap_number']] .= rtrim(
$data[
'answer_text']);
442 $correct_answers[
$data[
'gap_number']] .= rtrim(
$data[
'answer_text']);
450 $correct_answers = array();
451 $res = $this->db->queryF(
452 'SELECT answer_text FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s AND gap_number = %s',
453 array(
'integer',
'integer'), array($question_id, $gap_id)
457 $correct_answers[] = rtrim(
$data[
'answer_text']);
465 $res = $this->db->queryF(
466 'SELECT points FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s AND gap_number = %s GROUP BY gap_number, points',
467 array(
'integer',
'integer'), array($question_id, $gap_id)
498 $this_id = $this->
getId();
502 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
506 if( (
int)$testObjId > 0 )
508 $clone->setObjId($testObjId);
534 $clone->copyPageOfQuestion($this_id);
535 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
536 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
550 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
553 $source_questionpool_id = $this->
getObjId();
554 $clone->setObjId($target_questionpool_id);
564 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
577 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
580 $sourceParentId = $this->
getObjId();
586 $clone->setObjId($targetParentId);
588 if ($targetQuestionTitle)
590 $clone->setTitle($targetQuestionTitle);
594 $clone->copyPageOfQuestion($sourceQuestionId);
595 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
597 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
618 throw new ilTestException(
'return details not implemented for '.__METHOD__);
621 $found_values = array();
629 $found_values[(int)
$data[
'value1']] =
$data[
'value2'];
640 foreach($found_values as $key => $answer)
645 if(in_array($answer, $correct_answers))
666 include_once
"./Modules/Test/classes/class.ilObjTest.php";
687 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
695 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
706 $solutionSubmit = array();
709 foreach($answer as $key => $value)
711 $solutionSubmit[$key] = $value;
714 return $solutionSubmit;
719 if( array_key_exists(
'answer',
$_POST) )
748 return "assLongMenu";
758 return 'qpl_qst_lome';
783 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
791 foreach ($solution as $solutionvalue)
793 if ($gap_index == $solutionvalue[
"value1"])
797 case self::ANSWER_TYPE_SELECT_VAL:
798 $value = $solutionvalue[
"value2"];
803 $worksheet->writeString($startrow + $i, 1, $value);
805 case self::ANSWER_TYPE_TEXT_VAL:
806 $worksheet->writeString($startrow + $i, 1, $solutionvalue[
"value2"]);
813 return $startrow + $i + 1;
858 array( $question_id )
881 include_once(
"./Services/RTE/classes/class.ilRTE.php");
892 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
893 'allcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getId()
Gets the id of the assQuestion object.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
Base class for ILIAS Exception handling.
getPoints()
Returns the maximum available points for the question.
Abstract basic class which is to be extended by the concrete assessment question type classes...
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_convert_text($a_text, $a_target="has been removed")
setId($id=-1)
Sets the id of the assQuestion object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
migrateToLmContent($content)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
setNrOfTries($a_nr_of_tries)
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
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...
getObjId()
Get the object id of the container object.
getShuffle()
Gets the shuffle flag.
Base Exception for all Exceptions relating to Modules/Test.
setParticipantsSolution($participantSolution)
manipulateF($a_query, $a_types, $a_values)
Formatted manupulate (for DELETE, UPDATE, INSERT).
fetchAssoc($a_set)
Fetch row as associative array from result set.
setAuthor($author="")
Sets the authors name of the assQuestion object.
Class ilUserQuestionResult.
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
getQuestion()
Gets the question string of the question object.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
_getLogLanguage()
retrieve the log language for assessment logging
queryF($a_query, $a_types, $a_values)
Formatted query (for SELECTS).
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
static getDataDir()
get data directory (outside webspace)
setQuestion($question="")
Sets the question string of the question object.
const FEEDBACK_SETTING_ALL
Interface ilObjQuestionScoringAdjustable.
setOriginalId($original_id)
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getTitle()
Gets the title string of the assQuestion object.
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.