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';
108 $javaapplet_filename =
"" 113 $this->parameters =
array();
125 $params_array = explode(
"<separator>",
$params);
126 foreach ($params_array as $pair)
128 if (preg_match(
"/(.*?)\=(.*)/", $pair, $matches))
133 $this->java_code = $matches[2];
135 case "java_codebase" :
136 $this->java_codebase = $matches[2];
138 case "java_archive" :
139 $this->java_archive = $matches[2];
142 $this->java_width = $matches[2];
145 $this->java_height = $matches[2];
148 if (preg_match(
"/param_name_(\d+)/", $matches[1], $found_key))
150 $this->parameters[$found_key[1]][
"name"] = $matches[2];
152 if (preg_match(
"/param_value_(\d+)/", $matches[1], $found_key))
154 $this->parameters[$found_key[1]][
"value"] = $matches[2];
169 $params_array =
array();
170 if ($this->java_code)
172 array_push($params_array,
"java_code=$this->java_code");
174 if ($this->java_codebase)
176 array_push($params_array,
"java_codebase=$this->java_codebase");
178 if ($this->java_archive)
180 array_push($params_array,
"java_archive=$this->java_archive");
182 if ($this->java_width)
184 array_push($params_array,
"java_width=$this->java_width");
186 if ($this->java_height)
188 array_push($params_array,
"java_height=$this->java_height");
190 foreach ($this->parameters as $key => $value)
192 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
193 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
196 return join($params_array,
"<separator>");
206 $params_array =
array();
207 if ($this->java_code)
209 array_push($params_array,
"java_code=$this->java_code");
210 array_push($params_array,
"java_codebase=$this->java_codebase");
211 array_push($params_array,
"java_archive=$this->java_archive");
213 foreach ($this->parameters as $key => $value)
215 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
216 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
218 return join($params_array,
"<separator>");
228 if (strlen($this->title)
231 && $this->javaapplet_filename
233 && $this->java_height
239 else if (strlen($this->title)
245 && $this->java_height
279 ) .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
280 array(
"integer",
"text",
"text" ),
283 $this->javaapplet_filename,
306 $this->
setId($question_id);
315 include_once(
"./Services/RTE/classes/class.ilRTE.php");
329 parent::loadFromDb($question_id);
345 $this_id = $this->
getId();
349 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
353 if( (
int)$testObjId > 0 )
355 $clone->setObjId($testObjId);
380 $clone->copyPageOfQuestion($this_id);
382 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
384 $clone->duplicateApplet($this_id, $thisObjId);
386 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
407 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
410 $source_questionpool_id = $this->
getObjId();
411 $clone->setObjId($target_questionpool_id);
423 $clone->copyApplet(
$original_id, $source_questionpool_id);
425 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
438 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
441 $sourceParentId = $this->
getObjId();
447 $clone->setObjId($targetParentId);
449 if ($targetQuestionTitle)
451 $clone->setTitle($targetQuestionTitle);
456 $clone->copyPageOfQuestion($sourceQuestionId);
458 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
460 $clone->copyApplet($sourceQuestionId, $sourceParentId);
462 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
470 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
472 if( (
int)$objectId > 0 )
474 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
477 if (!file_exists($javapath))
482 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
483 print
"java applet could not be duplicated!!!! ";
490 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
491 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
492 if (!file_exists($javapath))
497 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
498 print
"java applet could not be copied!!!! ";
646 throw new ilTestException(
'return details not implemented for '.__METHOD__);
651 $found_values =
array();
673 if( isset($solution[
'points']) )
675 $points += $solution[
'points'];
718 $found_values =
array();
723 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
724 array(
'integer',
'integer',
'integer'),
728 $user_result =
array();
732 if (
$data[
"points"] > 0)
738 "points" =>
$data[
"points"],
740 "value1" =>
$data[
"value1"],
741 "value2" =>
$data[
"value2"],
744 array_push($user_result, $solution);
762 $this->parameters[$index] =
array(
"name" => $name,
"value" => $value);
766 array_push($this->parameters,
array(
"name" => $name,
"value" => $value));
772 if (array_key_exists($index, $this->parameters))
775 $newparams =
array();
776 for ($i = 0; $i < $index; $i++)
778 array_push($newparams, $this->parameters[$i]);
780 array_push($newparams,
array($name, $value));
781 for ($i = $index; $i < count($this->parameters); $i++)
783 array_push($newparams, $this->parameters[$i]);
785 $this->parameters = $newparams;
789 array_push($this->parameters,
array($name, $value));
802 if ($index < 0)
return;
803 if (count($this->parameters) < 1)
return;
804 if ($index >= count($this->parameters))
return;
805 unset($this->parameters[$index]);
806 $this->parameters = array_values($this->parameters);
819 if (($index < 0)
or ($index >= count($this->parameters)))
823 return $this->parameters[$index];
836 foreach ($this->parameters as $key => $value)
838 if (array_key_exists($name, $value))
855 return count($this->parameters);
866 $this->parameters =
array();
925 if (!empty($javaapplet_filename))
929 if (!empty($javaapplet_tempfilename))
932 if (!file_exists($javapath))
939 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
952 $this->javaapplet_filename =
"";
962 return "assJavaApplet";
972 return "qpl_qst_javaapplet";
981 return parent::getRTETextWithMediaObjects();
994 foreach ($solutions as $solution)
996 $worksheet->setCell($startrow + $i, 1, $this->lng->txt(
"result") .
" $i");
997 if (strlen($solution[
"value1"]))
$worksheet->setCell($startrow + $i, 1, $solution[
"value1"]);
998 if (strlen($solution[
"value2"]))
$worksheet->setCell($startrow + $i, 2, $solution[
"value2"]);
1002 return $startrow + $i + 1;
1020 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1079 return parent::buildTestPresentationConfig()
1081 ->setFormChangeDetectionEnabled(
false)
1082 ->setBackgroundChangeDetectionEnabled(
true);
duplicateApplet($question_id, $objectId=null)
getParameterIndex($name)
Returns the index of an applet parameter.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
addParameter($name="", $value="")
Adds a new parameter value to the parameter list.
getId()
Gets the id of the assQuestion object.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
static _getOriginalId($question_id)
Returns the original id of a question.
deleteJavaAppletFilename()
const PercentageResultExpression
Class iQuestionCondition.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{}
getQuestionType()
Returns the question type of the question.
flushParams()
Removes all applet parameters.
getSolutionValuesRegardlessOfAuthorization($active_id, $pass=NULL)
getJavaWidth()
Returns the java applet width parameter.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
getPoints()
Returns the maximum available points for the question.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assJavaApplet.
Abstract basic class which is to be extended by the concrete assessment question type classes...
getAdditionalTableName()
Returns the name of the additional question data table in the database.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
setJavaHeight($java_height="")
Sets the java applet height parameter.
ensureNonNegativePoints($points)
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
setId($id=-1)
Sets the id of the assQuestion object.
setJavaArchive($java_archive="")
Sets the java applet archive parameter.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
splitParams($params="")
Sets the applet parameters from a parameter string containing all parameters in a list...
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
addParameterAtIndex($index=0, $name="", $value="")
getJavaPath()
Returns the image path for web accessable images of a question.
Class for Java Applet Questions.
copyApplet($question_id, $source_questionpool)
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getParticipantsSolution()
loadFromDb($question_id)
Loads a assJavaApplet object from a database.
buildParamsOnly()
Returns a string containing the additional applet parameters.
setNrOfTries($a_nr_of_tries)
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
getParameterCount()
Returns the number of additional applet parameters.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
getReachedInformation($active_id, $pass=NULL)
Returns the evaluation data, a learner has entered to answer the question.
setJavaWidth($java_width="")
Sets the java applet width parameter.
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.
Base Exception for all Exceptions relating to Modules/Test.
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
saveToDb($original_id="")
Saves a assJavaApplet object to a database.
setAuthor($author="")
Sets the authors name of the assQuestion object.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getJavaHeight()
Returns the java applet height parameter.
getJavaAppletFilename()
Gets the java applet file name.
getParameter($index)
Returns the paramter at a given index.
Class ilUserQuestionResult.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{}
removeParameter($index)
Removes a parameter value from the parameter list.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
getOperators($expression)
Get all available operations for a specific question.
getJavaCodebase()
Returns the java applet codebase parameter.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
Create styles array
The data for the language used.
static getOperatorsByExpression($expression)
buildTestPresentationConfig()
Get the test question configuration.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $javaapplet_filename="")
assJavaApplet constructor
setJavaAppletFilename($javaapplet_filename, $javaapplet_tempfilename="")
Sets the java applet file name.
setJavaCodebase($java_codebase="")
Sets the java applet codebase parameter.
getJavaArchive()
Returns the java applet archive parameter.
setQuestion($question="")
Sets the question string of the question object.
Interface ilObjQuestionScoringAdjustable.
setOriginalId($original_id)
buildParams()
Returns a string containing the applet parameters.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
isComplete()
Returns true, if a imagemap question is complete for use.
getExpressionTypes()
Get all available expression types for a specific question.
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
getJavaCode()
Returns the java applet code parameter.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
copyObject($target_questionpool_id, $title="")
Copies an assJavaApplet object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setJavaCode($java_code="")
Sets the java applet code parameter.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
const EmptyAnswerExpression