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.ilObjAnswerScoringAdjustable.php';
 
    8require_once 
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
 
    9require_once 
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
 
   69                $this->answers = array();
 
   70                $this->coords = array();
 
  101                if (strlen($this->title) 
 
  104                        && ($this->image_filename) 
 
  105                        && (count($this->answers)) 
 
  134                $ilDB->manipulateF( 
"DELETE FROM qpl_a_imagemap WHERE question_fi = %s",
 
  136                                                        array( $this->
getId() )
 
  140                foreach ($this->answers as $key => $value)
 
  142                        $answer_obj   = $this->answers[$key];
 
  143                        $next_id      = 
$ilDB->nextId( 
'qpl_a_imagemap' );
 
  144                        $ilDB->manipulateF( 
"INSERT INTO qpl_a_imagemap (answer_id, question_fi, answertext, points, aorder, coords, area, points_unchecked) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
 
  145                                                                        array( 
"integer", 
"integer", 
"text", 
"float", 
"integer", 
"text", 
"text", 
"float" ),
 
  146                                                                        array( $next_id, $this->
id, $answer_obj->getAnswertext(
 
  147                                                                        ), $answer_obj->getPoints(), $answer_obj->getOrder(
 
  148                                                                        ), $answer_obj->getCoords(), $answer_obj->getArea(
 
  149                                                                        ), $answer_obj->getPointsUnchecked() )
 
  160                                                        array( $this->
getId() )
 
  164                                                                                                                                                ) . 
" (question_fi, image_file, is_multiple_choice) VALUES (%s, %s, %s)",
 
  165                                                        array( 
"integer", 
"text", 
'integer' ),
 
  168                                                                $this->image_filename,
 
  169                                                                (
int)$this->is_multiple_choice
 
  187                $this_id = $this->
getId();
 
  191                include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  195                if( (
int)$testObjId > 0 )
 
  197                        $clone->setObjId($testObjId);
 
  222                $clone->copyPageOfQuestion($this_id);
 
  224                $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
 
  226                $clone->duplicateImage($this_id, $thisObjId);
 
  228                $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
 
  249                include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  252                $source_questionpool_id = $this->
getObjId();
 
  253                $clone->setObjId($target_questionpool_id);
 
  265                $clone->copyImage(
$original_id, $source_questionpool_id);
 
  267                $clone->onCopy($source_questionpool_id, 
$original_id, $clone->getObjId(), $clone->getId());
 
  280                include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  283                $sourceParentId = $this->
getObjId();
 
  289                $clone->setObjId($targetParentId);
 
  291                if ($targetQuestionTitle)
 
  293                        $clone->setTitle($targetQuestionTitle);
 
  298                $clone->copyPageOfQuestion($sourceQuestionId);
 
  300                $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
 
  302                $clone->copyImage($sourceQuestionId, $sourceParentId);
 
  304                $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
 
  312                $imagepath_original = str_replace(
"/$this->id/images", 
"/$question_id/images", $imagepath);
 
  314                if( (
int)$objectId > 0 )
 
  316                        $imagepath_original = str_replace(
"/$this->obj_id/", 
"/$objectId/", $imagepath_original);
 
  319                if (!file_exists($imagepath)) {
 
  324                        print "image could not be duplicated!!!! ";
 
  331                $imagepath_original = str_replace(
"/$this->id/images", 
"/$question_id/images", $imagepath);
 
  332                $imagepath_original = str_replace(
"/$this->obj_id/", 
"/$source_questionpool/", $imagepath_original);
 
  333                if (!file_exists($imagepath)) 
 
  340                        print "image could not be copied!!!! ";
 
  364                        $this->
setId($question_id);
 
  374                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  387                        $result = 
$ilDB->queryF(
"SELECT * FROM qpl_a_imagemap WHERE question_fi = %s ORDER BY aorder ASC",
 
  391                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
 
  400                parent::loadFromDb($question_id);
 
  412                if (!empty($imagemap_filename)) 
 
  414                        $fp = fopen($imagemap_filename, 
"r");
 
  415                        $contents = fread($fp, filesize($imagemap_filename));
 
  417                        if (preg_match_all(
"/<area(.+)>/siU", $contents, $matches)) 
 
  419                                for ($i=0; $i< count($matches[1]); $i++) 
 
  421                                        preg_match(
"/alt\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $alt);
 
  422                                        preg_match(
"/coords\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], 
$coords);
 
  423                                        preg_match(
"/shape\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $shape);
 
  424                                        $this->
addAnswer($alt[1], 0.0, count($this->answers), 
$coords[1], $shape[1]);
 
  451                if (!empty($image_tempfilename)) 
 
  454                        if (!file_exists($imagepath)) 
 
  460                                $this->
ilias->raiseError(
"The image could not be uploaded!", $this->
ilias->error_obj->MESSAGE);
 
  462                        global 
$ilLog; 
$ilLog->write(
"gespeichert: " . $imagepath.$image_filename);
 
  477                for ($i = 0; $i < count($this->answers); $i++) {
 
  481                        $imagemap_contents .= 
"href=\"$href&selimage=" . $this->answers[$i]->getOrder() . 
"\" /> ";
 
  507                $points_unchecked = 0.0
 
  510                include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
 
  511                if (array_key_exists($order, $this->answers)) 
 
  515                        for ($i = count($this->answers) - 1; $i >= $order; $i--) 
 
  517                                $this->answers[$i+1] = $this->answers[$i];
 
  518                                $this->answers[$i+1]->setOrder($i+1);
 
  520                        $this->answers[$order] = $answer;
 
  526                        array_push($this->answers, $answer);
 
  540                return count($this->answers);
 
  555                if ($index < 0) 
return NULL;
 
  556                if (count($this->answers) < 1) 
return NULL;
 
  557                if ($index >= count($this->answers)) 
return NULL;
 
  558                return $this->answers[$index];
 
  587                if ($index < 0) 
return;
 
  588                if (count($this->answers) < 1) 
return;
 
  589                if ($index >= count($this->answers)) 
return;
 
  590                unset($this->answers[$index]);
 
  591                $this->answers = array_values($this->answers);
 
  592                for ($i = 0; $i < count($this->answers); $i++) {
 
  593                        if ($this->answers[$i]->getOrder() > $index) {
 
  594                                $this->answers[$i]->setOrder($i);
 
  608                $this->answers = array();
 
  621                foreach ($this->answers as $key => $value) {
 
  622                        if($this->is_multiple_choice)
 
  624                                if($value->getPoints() > $value->getPointsUnchecked())
 
  626                                        $points += $value->getPoints();
 
  630                                        $points += $value->getPointsUnchecked();
 
  635                                if($value->getPoints() > 
$points)
 
  658                        throw new ilTestException(
'return details not implemented for '.__METHOD__);
 
  663                $found_values = array();
 
  668                $result = $this->getCurrentSolutionResultSet($active_id, 
$pass);
 
  671                        if (strcmp(
$data[
"value1"], 
"") != 0)
 
  673                                array_push($found_values, 
$data[
"value1"]);
 
  707                        include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  713                if($this->is_multiple_choice && strlen(
$_GET[
'remImage']))
 
  715                        $query  = 
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND value1 = %s";
 
  716                        $types  = array(
"integer", 
"integer", 
"integer", 
"integer");
 
  719                        if( $this->
getStep() !== NULL )
 
  721                                $query .= 
" AND step = %s ";
 
  722                                $types[]  = 
'integer';
 
  725                        $affectedRows = 
$ilDB->manipulateF(
$query, $types, $values);
 
  727                elseif(!$this->is_multiple_choice)
 
  729                        $affectedRows = $this->removeCurrentSolution($active_id, 
$pass);
 
  732                if (strlen(
$_GET[
"selImage"]))
 
  734                        $imageWasSelected = 
true;
 
  736                        $types = array(
'integer', 
'integer', 
'integer', 
'integer');
 
  737                        $values = array($active_id, $this->
getId(), 
$pass,  (
int)
$_GET[
'selImage']);
 
  738                        $query = 
'DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND value1 = %s';
 
  741                                $types[] = 
'integer';
 
  743                                $query .= 
' AND step = %s';
 
  746                        $ilDB->manipulateF(
$query, $types, $values);
 
  748                        $affectedRows = $this->saveCurrentSolution($active_id, 
$pass, 
$_GET[
'selImage'], 
null);
 
  752                        $imageWasSelected = 
false;
 
  757                require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
  760                        if( $imageWasSelected )
 
  777                if( $this->is_multiple_choice && strlen(
$_GET[
'remImage']) )
 
  779                        unset($solution[(
int)
$_GET[
'remImage']]);
 
  782                if( strlen(
$_GET[
'selImage']) )
 
  784                        if( !$this->is_multiple_choice )
 
  789                        $solution[(int)
$_GET[
'selImage']] = (
int)
$_GET[
'selImage'];
 
  812                        parent::syncWithOriginal();
 
  826                return "assImagemapQuestion";
 
  839                return "qpl_qst_imagemap";
 
  852                return "qpl_a_imagemap";
 
  861                $text = parent::getRTETextWithMediaObjects();
 
  862                foreach ($this->answers as $index => $answer)
 
  864                        $text .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->
getId(), $index);
 
  883                include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
 
  890                        $worksheet->writeString($startrow + $i, 0, 
ilExcelUtils::_convert_text($answer->getArea() . 
": " . $answer->getCoords()), $format_bold);
 
  891                        if (
$id == $solution[0][
"value1"])
 
  893                                $worksheet->write($startrow + $i, 1, 1);
 
  897                                $worksheet->write($startrow + $i, 1, 0);
 
  901                return $startrow + $i + 1;
 
  912                $this->image_filename = 
"";
 
  920                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  930                        'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), 
false)),
 
  931                        'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), 
true))
 
  937                foreach ($this->
getAnswers() as $key => $answer_obj)
 
  940                                "answertext"       => (
string)$answer_obj->getAnswertext(),
 
  941                                "points"           => (
float)$answer_obj->getPoints(),
 
  942                                "points_unchecked" => (
float)$answer_obj->getPointsUnchecked(),
 
  943                                "order"            => (
int)$order,
 
  944                                "coords"           => $answer_obj->getCoords(),
 
  945                                "state"            => $answer_obj->getState(),
 
  946                                "area"             => $answer_obj->getArea(),
 
  947                                "feedback"         => $this->formatSAQuestion(
 
  948                                        $this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), $key)
 
  968                if(count($found_values) > 0)
 
  970                        foreach($this->answers as $key => $answer)
 
  972                                if(in_array($key, $found_values))
 
  974                                        $points += $answer->getPoints();
 
  977                                        $points += $answer->getPointsUnchecked();
 
  995                require_once 
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
 
 1028                        "SELECT value1+1 as value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = ( 
 1029                                SELECT MAX(step) FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s 
 1031                        array(
"integer", 
"integer", 
"integer",
"integer", 
"integer", 
"integer"),
 
Class for true/false or yes/no answers.
Class for image map questions.
uploadImagemap($imagemap_filename="")
Uploads an image map and takes over the areas.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
getQuestionType()
Returns the question type of the question.
setIsMultipleChoice($is_multiple_choice)
Set true if the Imagemapquestion is a multiplechoice Question.
flushAnswers()
Deletes all answers.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
toJSON()
Returns a JSON representation of the question.
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this question.
duplicateImage($question_id, $objectId=null)
setImageFilename($image_filename, $image_tempfilename="")
Sets the image file name.
getAnswer($index=0)
Returns an answer.
getAnswerTableName()
Returns the name of the answer table in the database.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assImagemapQuestion.
getExpressionTypes()
Get all available expression types for a specific question.
copyObject($target_questionpool_id, $title="")
Copies an assImagemapQuestion object.
deleteImage()
Deletes the image file.
calculateReachedPointsForSolution($found_values)
isComplete()
Returns true, if a imagemap question is complete for use.
getOperators($expression)
Get all available operations for a specific question.
saveWorkingData($active_id, $pass=NULL)
Saves the learners input of the question to the database.
deleteArea($index=0)
Deletes an answer.
& getAnswers()
Returns the answer array.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
copyImage($question_id, $source_questionpool)
loadFromDb($question_id)
Loads a assImagemapQuestion object from a database.
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $image_filename="")
assImagemapQuestion constructor
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveToDb($original_id="")
Saves an assImagemapQuestion object to a database.
addAnswer( $answertext="", $points=0.0, $order=0, $coords="", $area="", $points_unchecked=0.0)
Adds a possible answer for a imagemap question.
getAnswerCount()
Returns the number of answers.
get_imagemap_contents($href="#")
Gets the imagemap file contents.
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.
const MODE_MULTIPLE_CHOICE
savePreviewData(ilAssQuestionPreviewSession $previewSession)
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
Abstract basic class which is to be extended by the concrete assessment question type classes.
& getSolutionValues($active_id, $pass=NULL)
Loads solutions of a given user from the database an returns it.
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.
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.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
setAuthor($author="")
Sets the authors name of the assQuestion object.
getShuffle()
Gets the shuffle flag.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
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.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getParticipantsSolution()
setParticipantsSolution($participantSolution)
_convert_text($a_text, $a_target="has been removed")
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
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
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
const EmptyAnswerExpression
const ExclusiveResultExpression
const NumberOfResultExpression
Interface ilObjAnswerScoringAdjustable.
Interface ilObjQuestionScoringAdjustable.
redirection script todo: (a better solution should control the processing via a xml file)