4require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
8require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
30 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
148 if (strlen($this->title)
151 &&
sizeof($this->answers) > 0
152 &&
sizeof($this->correct_answers) > 0
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]);
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)
429 $res = $this->db->queryF(
430 'SELECT gap_number, answer_text FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s',
431 array(
'integer'), array($question_id)
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)
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)
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"])
798 $value = $solutionvalue[
"value2"];
803 $worksheet->writeString($startrow + $i, 1, $value);
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))
Abstract basic class which is to be extended by the concrete assessment question type classes.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
saveQuestionDataToDb($original_id="")
getId()
Gets the id of the assQuestion object.
getObjId()
Get the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
getShuffle()
Gets the shuffle flag.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
getTitle()
Gets the title string of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
setQuestion($question="")
Sets the question string of the question object.
const FEEDBACK_SETTING_ALL
setParticipantsSolution($participantSolution)
queryF($a_query, $a_types, $a_values)
Formatted query (for SELECTS).
manipulateF($a_query, $a_types, $a_values)
Formatted manupulate (for DELETE, UPDATE, INSERT).
fetchAssoc($a_set)
Fetch row as associative array from result set.
_convert_text($a_text, $a_target="has been removed")
Base class for ILIAS Exception handling.
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
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...
Base Exception for all Exceptions relating to Modules/Test.
Class ilUserQuestionResult.
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
migrateToLmContent($content)
Interface ilObjQuestionScoringAdjustable.