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($params_array, 
"<separator>");
 
  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($params_array, 
"<separator>");
 
  214        if (strlen($this->title)
 
  217            && $this->javaapplet_filename
 
  219            && $this->java_height
 
  223        } elseif (strlen($this->title)
 
  229            && $this->java_height
 
  260            array( $this->
getId() )
 
  264                                                            ) . 
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
 
  265            array( 
"integer", 
"text", 
"text" ),
 
  268                                $this->javaapplet_filename,
 
  291            $this->
setId($question_id);
 
  300            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  311        parent::loadFromDb($question_id);
 
  321        if ($this->
id <= 0) {
 
  326        $this_id = $this->
getId();
 
  330        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  334        if ((
int) $testObjId > 0) {
 
  335            $clone->setObjId($testObjId);
 
  354        $clone->copyPageOfQuestion($this_id);
 
  356        $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
 
  358        $clone->duplicateApplet($this_id, $thisObjId);
 
  360        $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
 
  374        if ($this->
id <= 0) {
 
  380        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  383        $source_questionpool_id = $this->
getObjId();
 
  384        $clone->setObjId($target_questionpool_id);
 
  395        $clone->copyApplet(
$original_id, $source_questionpool_id);
 
  397        $clone->onCopy($source_questionpool_id, 
$original_id, $clone->getObjId(), $clone->getId());
 
  404        if ($this->
id <= 0) {
 
  409        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  412        $sourceParentId = $this->
getObjId();
 
  418        $clone->setObjId($targetParentId);
 
  420        if ($targetQuestionTitle) {
 
  421            $clone->setTitle($targetQuestionTitle);
 
  426        $clone->copyPageOfQuestion($sourceQuestionId);
 
  428        $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
 
  430        $clone->copyApplet($sourceQuestionId, $sourceParentId);
 
  432        $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
 
  440        $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/", 
"\${1}$question_id\${2}", $javapath);
 
  442        if ((
int) $objectId > 0) {
 
  443            $javapath_original = str_replace(
"/$this->obj_id/", 
"/$objectId/", $javapath_original);
 
  446        if (!file_exists($javapath)) {
 
  451            print "java applet could not be duplicated!!!! ";
 
  455    public function copyApplet($question_id, $source_questionpool)
 
  458        $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/", 
"\${1}$question_id\${2}", $javapath);
 
  459        $javapath_original = str_replace(
"/$this->obj_id/", 
"/$source_questionpool/", $javapath_original);
 
  460        if (!file_exists($javapath)) {
 
  465            print "java applet could not be copied!!!! ";
 
  611        if ($returndetails) {
 
  612            throw new ilTestException(
'return details not implemented for ' . __METHOD__);
 
  617        $found_values = array();
 
  618        if (is_null(
$pass)) {
 
  636            if (isset($solution[
'points'])) {
 
  637                $points += $solution[
'points'];
 
  679        $found_values = array();
 
  680        if (is_null(
$pass)) {
 
  684            "SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
  685            array(
'integer',
'integer',
'integer'),
 
  689        $user_result = array();
 
  692            if (
$data[
"points"] > 0) {
 
  697                "points" => 
$data[
"points"],
 
  699                "value1" => 
$data[
"value1"],
 
  700                "value2" => 
$data[
"value2"],
 
  703            array_push($user_result, $solution);
 
  720            $this->parameters[
$index] = array(
"name" => 
$name, 
"value" => $value);
 
  722            array_push($this->parameters, array(
"name" => 
$name, 
"value" => $value));
 
  728        if (array_key_exists(
$index, $this->parameters)) {
 
  730            $newparams = array();
 
  732                array_push($newparams, $this->parameters[
$i]);
 
  734            array_push($newparams, array(
$name, $value));
 
  735            for (
$i = 
$index; 
$i < count($this->parameters); 
$i++) {
 
  736                array_push($newparams, $this->parameters[
$i]);
 
  738            $this->parameters = $newparams;
 
  740            array_push($this->parameters, array(
$name, $value));
 
  756        if (count($this->parameters) < 1) {
 
  759        if (
$index >= count($this->parameters)) {
 
  762        unset($this->parameters[
$index]);
 
  763        $this->parameters = array_values($this->parameters);
 
  776        if ((
$index < 0) or (
$index >= count($this->parameters))) {
 
  779        return $this->parameters[
$index];
 
  792        foreach ($this->parameters as 
$key => $value) {
 
  793            if (array_key_exists(
$name, $value)) {
 
  809        return count($this->parameters);
 
  820        $this->parameters = array();
 
  882        if (!empty($javaapplet_tempfilename)) {
 
  884            if (!file_exists($javapath)) {
 
  889                $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
 
  900        $this->javaapplet_filename = 
"";
 
  910        return "assJavaApplet";
 
  920        return "qpl_qst_javaapplet";
 
  929        return parent::getRTETextWithMediaObjects();
 
  942        foreach ($solutions as $solution) {
 
  943            $worksheet->setCell($startrow + 
$i, 1, $this->lng->txt(
"result") . 
" $i");
 
  944            if (strlen($solution[
"value1"])) {
 
  945                $worksheet->setCell($startrow + 
$i, 1, $solution[
"value1"]);
 
  947            if (strlen($solution[
"value2"])) {
 
  948                $worksheet->setCell($startrow + 
$i, 2, $solution[
"value2"]);
 
  953        return $startrow + 
$i + 1;
 
  971        require_once 
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
 
 1030        return parent::buildTestPresentationConfig()
 
 1032            ->setFormChangeDetectionEnabled(
false)
 
 1033            ->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)
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
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.
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)
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 makeDirParents($a_dir)
Create a new directory and all parent directories.
Class iQuestionCondition.
const PercentageResultExpression
const EmptyAnswerExpression
Interface ilObjQuestionScoringAdjustable.