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';
112 $this->parameters = array();
124 $params_array = explode(
"<separator>", $params);
125 foreach ($params_array as $pair) {
126 if (preg_match(
"/(.*?)\=(.*)/", $pair, $matches)) {
127 switch ($matches[1]) {
129 $this->java_code = $matches[2];
131 case "java_codebase":
132 $this->java_codebase = $matches[2];
135 $this->java_archive = $matches[2];
138 $this->java_width = $matches[2];
141 $this->java_height = $matches[2];
144 if (preg_match(
"/param_name_(\d+)/", $matches[1], $found_key)) {
145 $this->parameters[$found_key[1]][
"name"] = $matches[2];
147 if (preg_match(
"/param_value_(\d+)/", $matches[1], $found_key)) {
148 $this->parameters[$found_key[1]][
"value"] = $matches[2];
163 $params_array = array();
164 if ($this->java_code) {
165 array_push($params_array,
"java_code=$this->java_code");
167 if ($this->java_codebase) {
168 array_push($params_array,
"java_codebase=$this->java_codebase");
170 if ($this->java_archive) {
171 array_push($params_array,
"java_archive=$this->java_archive");
173 if ($this->java_width) {
174 array_push($params_array,
"java_width=$this->java_width");
176 if ($this->java_height) {
177 array_push($params_array,
"java_height=$this->java_height");
179 foreach ($this->parameters as $key => $value) {
180 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
181 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
184 return join(
"<separator>", $params_array);
194 $params_array = array();
195 if ($this->java_code) {
196 array_push($params_array,
"java_code=$this->java_code");
197 array_push($params_array,
"java_codebase=$this->java_codebase");
198 array_push($params_array,
"java_archive=$this->java_archive");
200 foreach ($this->parameters as $key => $value) {
201 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
202 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
204 return join(
"<separator>", $params_array);
214 if (strlen($this->title)
217 && $this->javaapplet_filename
219 && $this->java_height
223 } elseif (strlen($this->title)
229 && $this->java_height
261 array( $this->
getId() )
265 ) .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
266 array(
"integer",
"text",
"text" ),
269 $this->javaapplet_filename,
293 $this->
setId($question_id);
302 include_once(
"./Services/RTE/classes/class.ilRTE.php");
319 parent::loadFromDb($question_id);
329 if ($this->
id <= 0) {
334 $this_id = $this->
getId();
338 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
342 if ((
int) $testObjId > 0) {
343 $clone->setObjId($testObjId);
362 $clone->copyPageOfQuestion($this_id);
364 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
366 $clone->duplicateApplet($this_id, $thisObjId);
368 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
382 if ($this->
id <= 0) {
388 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
391 $source_questionpool_id = $this->
getObjId();
392 $clone->setObjId($target_questionpool_id);
403 $clone->copyApplet(
$original_id, $source_questionpool_id);
405 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
412 if ($this->
id <= 0) {
417 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
420 $sourceParentId = $this->
getObjId();
426 $clone->setObjId($targetParentId);
428 if ($targetQuestionTitle) {
429 $clone->setTitle($targetQuestionTitle);
434 $clone->copyPageOfQuestion($sourceQuestionId);
436 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
438 $clone->copyApplet($sourceQuestionId, $sourceParentId);
440 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
448 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
450 if ((
int) $objectId > 0) {
451 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
454 if (!file_exists($javapath)) {
459 print "java applet could not be duplicated!!!! ";
463 public function copyApplet($question_id, $source_questionpool)
466 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
467 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
468 if (!file_exists($javapath)) {
473 print "java applet could not be copied!!!! ";
619 if ($returndetails) {
620 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
626 $found_values = array();
627 if (is_null(
$pass)) {
645 if (isset($solution[
'points'])) {
646 $points += $solution[
'points'];
689 $found_values = array();
690 if (is_null(
$pass)) {
694 "SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
695 array(
'integer',
'integer',
'integer'),
699 $user_result = array();
702 if (
$data[
"points"] > 0) {
707 "points" =>
$data[
"points"],
709 "value1" =>
$data[
"value1"],
710 "value2" =>
$data[
"value2"],
713 array_push($user_result, $solution);
730 $this->parameters[
$index] = array(
"name" =>
$name,
"value" => $value);
732 array_push($this->parameters, array(
"name" =>
$name,
"value" => $value));
738 if (array_key_exists(
$index, $this->parameters)) {
740 $newparams = array();
742 array_push($newparams, $this->parameters[
$i]);
744 array_push($newparams, array(
$name, $value));
745 for (
$i =
$index;
$i < count($this->parameters);
$i++) {
746 array_push($newparams, $this->parameters[
$i]);
748 $this->parameters = $newparams;
750 array_push($this->parameters, array(
$name, $value));
766 if (count($this->parameters) < 1) {
769 if (
$index >= count($this->parameters)) {
772 unset($this->parameters[
$index]);
773 $this->parameters = array_values($this->parameters);
786 if ((
$index < 0) or (
$index >= count($this->parameters))) {
789 return $this->parameters[
$index];
802 foreach ($this->parameters as $key => $value) {
803 if (array_key_exists(
$name, $value)) {
819 return count($this->parameters);
830 $this->parameters = array();
884 if (!empty($javaapplet_tempfilename)) {
886 if (!file_exists($javapath)) {
891 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
902 $this->javaapplet_filename =
"";
912 return "assJavaApplet";
922 return "qpl_qst_javaapplet";
931 return parent::getRTETextWithMediaObjects();
939 parent::setExportDetailsXLS($worksheet, $startrow, $active_id,
$pass);
944 foreach ($solutions as $solution) {
945 $worksheet->setCell($startrow +
$i, 1, $this->lng->txt(
"result") .
" $i");
946 if (strlen($solution[
"value1"])) {
947 $worksheet->setCell($startrow +
$i, 1, $solution[
"value1"]);
949 if (strlen($solution[
"value2"])) {
950 $worksheet->setCell($startrow +
$i, 2, $solution[
"value2"]);
955 return $startrow +
$i + 1;
973 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1032 return parent::buildTestPresentationConfig()
1034 ->setFormChangeDetectionEnabled(
false)
1035 ->setBackgroundChangeDetectionEnabled(
true);
An exception for terminatinating execution or to throw for unit testing.
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="")
setJavaCode($java_code="")
Sets the java applet code parameter.
getReachedInformation($active_id, $pass=null)
Returns the evaluation data, a learner has entered to answer 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.
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.
getJavaAppletFilename()
Gets the java applet file name.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assJavaApplet.
getExpressionTypes()
Get all available expression types for a specific question.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
buildParams()
Returns a string containing the applet parameters.
getSolutionValuesRegardlessOfAuthorization($active_id, $pass=null)
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)
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)
buildTestPresentationConfig()
Get the test question configuration.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
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.
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.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
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.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
setAuthor($author="")
Sets the authors name of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
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.
ensureNonNegativePoints($points)
static getDraftInstance()
static getInstance($identifier)
getParticipantsSolution()
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc