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';
113 $this->parameters = array();
125 $params_array = split(
"<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
276 array( $this->
getId() )
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))
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))
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'];
715 $found_values = array();
720 $result =
$ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
721 array(
'integer',
'integer',
'integer'),
725 $user_result = array();
729 if (
$data[
"points"] > 0)
735 "points" =>
$data[
"points"],
737 "value1" =>
$data[
"value1"],
738 "value2" =>
$data[
"value2"],
741 array_push($user_result, $solution);
759 $this->parameters[$index] = array(
"name" => $name,
"value" => $value);
763 array_push($this->parameters, array(
"name" => $name,
"value" => $value));
769 if (array_key_exists($index, $this->parameters))
772 $newparams = array();
773 for ($i = 0; $i < $index; $i++)
775 array_push($newparams, $this->parameters[$i]);
777 array_push($newparams, array($name, $value));
778 for ($i = $index; $i < count($this->parameters); $i++)
780 array_push($newparams, $this->parameters[$i]);
782 $this->parameters = $newparams;
786 array_push($this->parameters, array($name, $value));
799 if ($index < 0)
return;
800 if (count($this->parameters) < 1)
return;
801 if ($index >= count($this->parameters))
return;
802 unset($this->parameters[$index]);
803 $this->parameters = array_values($this->parameters);
816 if (($index < 0) or ($index >= count($this->parameters)))
820 return $this->parameters[$index];
833 foreach ($this->parameters as $key => $value)
835 if (array_key_exists($name, $value))
852 return count($this->parameters);
863 $this->parameters = array();
930 if (!empty($javaapplet_tempfilename))
933 if (!file_exists($javapath))
940 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
953 $this->javaapplet_filename =
"";
963 return "assJavaApplet";
973 return "qpl_qst_javaapplet";
982 return parent::getRTETextWithMediaObjects();
999 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1004 foreach ($solutions as $solution)
1011 return $startrow + $i + 1;
1029 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
Class for Java Applet Questions.
flushParams()
Removes all applet parameters.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
addParameterAtIndex($index=0, $name="", $value="")
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
setJavaCode($java_code="")
Sets the java applet code parameter.
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getJavaCode()
Returns the java applet code parameter.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
setJavaWidth($java_width="")
Sets the java applet width parameter.
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
getOperators($expression)
Get all available operations for a specific question.
getJavaCodebase()
Returns the java applet codebase parameter.
buildParamsOnly()
Returns a string containing the additional applet parameters.
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this question.
getJavaAppletFilename()
Gets the java applet file name.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assJavaApplet.
getReachedInformation($active_id, $pass=NULL)
Returns the evaluation data, a learner has entered to answer the question.
getExpressionTypes()
Get all available expression types for a specific question.
buildParams()
Returns a string containing the applet parameters.
saveToDb($original_id="")
Saves a assJavaApplet object to a database.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
duplicateApplet($question_id, $objectId=null)
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $javaapplet_filename="")
assJavaApplet constructor
savePreviewData(ilAssQuestionPreviewSession $previewSession)
Reworks the allready saved working data if neccessary.
getJavaWidth()
Returns the java applet width parameter.
addParameter($name="", $value="")
Adds a new parameter value to the parameter list.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
copyApplet($question_id, $source_questionpool)
getQuestionType()
Returns the question type of the question.
getParameterIndex($name)
Returns the index of an applet parameter.
removeParameter($index)
Removes a parameter value from the parameter list.
getSolutionValuesRegardlessOfAuthorization($active_id, $pass=NULL)
deleteJavaAppletFilename()
getJavaHeight()
Returns the java applet height parameter.
getParameter($index)
Returns the paramter at a given index.
copyObject($target_questionpool_id, $title="")
Copies an assJavaApplet object.
setJavaHeight($java_height="")
Sets the java applet height parameter.
loadFromDb($question_id)
Loads a assJavaApplet object from a database.
setJavaAppletFilename($javaapplet_filename, $javaapplet_tempfilename="")
Sets the java applet file name.
getJavaArchive()
Returns the java applet archive parameter.
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
setJavaArchive($java_archive="")
Sets the java applet archive parameter.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
splitParams($params="")
Sets the applet parameters from a parameter string containing all parameters in a list.
isComplete()
Returns true, if a imagemap question is complete for use.
getParameterCount()
Returns the number of additional applet parameters.
setJavaCodebase($java_codebase="")
Sets the java applet codebase parameter.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
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.
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.
getJavaPath()
Returns the image path for web accessable images of a question.
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.
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)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getParticipantsSolution()
_convert_text($a_text, $a_target="has been removed")
static getOperatorsByExpression($expression)
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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Class iQuestionCondition.
const PercentageResultExpression
const EmptyAnswerExpression
Interface ilObjQuestionScoringAdjustable.