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';
147 if (strlen($this->title)
150 &&
sizeof($this->answers) > 0
151 &&
sizeof($this->correct_answers) > 0
187 if( !is_array($correct_answers_row[0]) ||
sizeof($correct_answers_row[0]) == 0)
191 if($correct_answers_row[1] > 0)
193 array_push(
$points, $correct_answers_row[1]);
213 foreach(
$answers[0] as $key => $answer)
215 if(!in_array($answer, $answer_options))
249 array( $this->
getId() )
252 ) .
" (question_fi, long_menu_text, feedback_setting, min_auto_complete) VALUES (%s, %s, %s, %s)",
253 array(
"integer",
"text",
"integer",
"integer"),
271 foreach($gap[0] as $position => $answer)
273 if($type_array ==
null)
279 $type = $type_array[$gap_number];
284 'question_fi' => array(
'integer', (
int)$this->
getId()),
285 'gap_number' => array(
'integer', (
int)$gap_number),
286 'position' => array(
'integer', (
int)$position)
289 'answer_text' => array(
'text', $answer),
290 'points' => array(
'float', $gap[1]),
291 'type' => array(
'integer', (
int) $type)
304 foreach($array as $gap => $values)
307 if(is_array($values))
309 foreach($values as $key => $value)
311 $file_content .= $value .
"\n";
313 $file_content = rtrim($file_content,
"\n");
315 fwrite(
$file, $file_content);
334 $gap = str_replace(
'.txt',
'', basename(
$file));
335 $answers[(int) $gap] = explode(
"\n", file_get_contents(
$file));
351 throw new ilException(
'Cannot create export directory');
355 !is_dir($folder_name) ||
356 !is_readable($folder_name) ||
357 !is_writable($folder_name)
360 throw new ilException(
'Cannot create export directory');
373 $this->
setId($question_id);
382 include_once(
"./Services/RTE/classes/class.ilRTE.php");
388 if( isset(
$data[
'feedback_setting']) )
403 parent::loadFromDb($question_id);
408 $res = $this->db->queryF(
409 "SELECT * FROM {$this->getAnswerTableName()} WHERE question_fi = %s ORDER BY gap_number, position ASC",
410 array(
'integer'), array($question_id)
428 $res = $this->db->queryF(
429 'SELECT gap_number, answer_text FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s',
430 array(
'integer'), array($question_id)
450 $res = $this->db->queryF(
451 'SELECT answer_text FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s AND gap_number = %s',
452 array(
'integer',
'integer'), array($question_id, $gap_id)
464 $res = $this->db->queryF(
465 'SELECT points FROM ' . $this->
getAnswerTableName() .
' WHERE question_fi = %s AND gap_number = %s GROUP BY gap_number, points',
466 array(
'integer',
'integer'), array($question_id, $gap_id)
497 $this_id = $this->
getId();
501 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
505 if( (
int)$testObjId > 0 )
507 $clone->setObjId($testObjId);
533 $clone->copyPageOfQuestion($this_id);
534 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
535 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
549 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
552 $source_questionpool_id = $this->
getObjId();
553 $clone->setObjId($target_questionpool_id);
563 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
576 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
579 $sourceParentId = $this->
getObjId();
585 $clone->setObjId($targetParentId);
587 if ($targetQuestionTitle)
589 $clone->setTitle($targetQuestionTitle);
593 $clone->copyPageOfQuestion($sourceQuestionId);
594 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
596 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
617 throw new ilTestException(
'return details not implemented for '.__METHOD__);
620 $found_values = array();
628 $found_values[(int)
$data[
'value1']] =
$data[
'value2'];
639 foreach($found_values as $key => $answer)
665 include_once
"./Modules/Test/classes/class.ilObjTest.php";
671 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function() use (&$entered_values, $active_id,
$pass, $authorized) {
689 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
697 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
718 'authorized' =>
false,
719 'intermediate' =>
false
723 SELECT authorized, COUNT(*) cnt
725 WHERE active_fi = " .
$ilDB->quote($activeId,
'integer') .
"
726 AND question_fi = ".
$ilDB->quote($this->
getId(),
'integer') .
"
727 AND pass = " .$ilDB->quote(
$pass,
'integer') .
"
731 if( $this->
getStep() !== NULL )
744 if (
$row[
'authorized']) {
745 $return[
'authorized'] =
$row[
'cnt'] > 0;
749 $return[
'intermediate'] =
$row[
'cnt'] > 0;
759 $solutionSubmit = array();
762 foreach($answer as $key => $value)
764 $solutionSubmit[$key] = $value;
767 return $solutionSubmit;
772 if( array_key_exists(
'answer',
$_POST) )
797 return "assLongMenu";
807 return 'qpl_qst_lome';
831 $worksheet->setCell($startrow + $i, 0, $this->lng->txt(
'assLongMenu') .
" $i");
833 foreach ($solution as $solutionvalue)
835 if ($gap_index == $solutionvalue[
"value1"])
840 $value = $solutionvalue[
"value2"];
845 $worksheet->setCell($startrow + $i, 1, $value);
848 $worksheet->setCell($startrow + $i, 1, $solutionvalue[
"value2"]);
856 return $startrow + $i + 1;
901 array( $question_id )
924 include_once(
"./Services/RTE/classes/class.ilRTE.php");
935 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
936 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
An exception for terminatinating execution or to throw for unit testing.
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.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
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.
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true)
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.
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
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.
Base class for ILIAS Exception handling.
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
migrateToLmContent($content)
Interface ilObjQuestionScoringAdjustable.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file