ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
assQuestion Class Reference

Basic class for all assessment question types. More...

+ Inheritance diagram for assQuestion:
+ Collaboration diagram for assQuestion:

Public Member Functions

 __construct ($title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object.
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question.
 isComplete ()
 Returns true, if a question is complete for use.
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database.
 setTitle ($title="")
 Sets the title string of the assQuestion object.
 setId ($id=-1)
 Sets the id of the assQuestion object.
 setTestId ($id=-1)
 Sets the test id of the assQuestion object.
 setComment ($comment="")
 Sets the comment string of the assQuestion object.
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type.
 setShuffle ($shuffle=true)
 Sets the shuffle flag.
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question.
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array
 setAuthor ($author="")
 Sets the authors name of the assQuestion object.
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object.
 getTitle ()
 Gets the title string of the assQuestion object.
 getId ()
 Gets the id of the assQuestion object.
 getShuffle ()
 Gets the shuffle flag.
 getTestId ()
 Gets the test id of the assQuestion object.
 getComment ()
 Gets the comment string of the assQuestion object.
 getOutputType ()
 Gets the output type.
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output.
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question.
 getAuthor ()
 Gets the authors name of the assQuestion object.
 getOwner ()
 Gets the creator/owner ID of the assQuestion object.
 getObjId ()
 Get the object id of the container object.
 setObjId ($obj_id=0)
 Set the object id of the container object.
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question.
_getQuestionInfo ($question_id)
 Returns question information from the database.
 getSuggestedSolutionOutput ()
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index.
 getSuggestedSolutions ()
 Return the suggested solutions.
 _getReachedPoints ($active_id, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question.
 getReachedPoints ($active_id, $pass=NULL)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database.
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question.
 calculateResultsFromSolution ($active_id, $pass=NULL)
 Calculates the question results from a previously saved question solution.
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database.
 _updateTestResultCache ($active_id)
 _updateTestPassResults ($active_id, $pass)
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log.
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log.
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it.
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution.
 getJavaPath ()
 Returns the image path for web accessable images of a question.
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question.
 getFlashPath ()
 Returns the image path for web accessable flash files of a question.
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question.
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution.
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question.
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question.
getSolutionValues ($active_id, $pass=NULL)
 Loads solutions of a given user from the database an returns it.
 isInUse ($question_id="")
 Checks whether the question is in use or not.
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not.
 pcArrayShuffle ($array)
 Shuffles the values of a given array.
 getQuestionTypeFromDb ($question_id)
 get question type for question id
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database.
 getAnswerTableName ()
 Returns the name of the answer table in the database.
 deleteAnswers ($question_id)
 Deletes datasets from answers tables.
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database.
 delete ($question_id)
 Deletes a question and all materials from the database.
 getTotalAnswers ()
 get total number of answers
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method
 _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method
 _getTitle ($a_q_id)
 Returns the title of a question.
 _getQuestionText ($a_q_id)
 Returns question text.
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 syncXHTMLMediaObjectsOfQuestion ()
 createPageObject ()
 create page object of question
 copyPageOfQuestion ($a_q_id)
 getPageOfQuestion ()
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id.
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id.
 setOriginalId ($original_id)
 getOriginalId ()
 loadFromDb ($question_id)
 Loads the question from the database.
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.
 saveQuestionDataToDb ($original_id="")
 saveToDb ($original_id="")
 Saves the question to the database.
 setNewOriginalId ($newId)
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database.
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index.
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index.
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question.
 _resolveInternalLink ($internal_link)
 _resolveIntLinks ($question_id)
 _getInternalLinkHref ($target="")
 _getOriginalId ($question_id)
 Returns the original id of a question.
 syncWithOriginal ()
 createRandomSolution ($test_id, $user_id)
 _questionExists ($question_id)
 Returns true if the question already exists in the database.
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool.
_instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id.
 getPoints ()
 Returns the maximum available points for the question.
 setPoints ($a_points)
 Sets the maximum available points for the question.
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution.
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution.
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user.
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not.
 calculateReachedPoints ($active_id, $pass=NULL, $points=0)
 Returns the points, a learner has reached answering the question The points are calculated from the given answers including checks for all special scoring options in the test container.
 isHTML ($a_text)
 Checks if a given string contains HTML or not.
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE)
 Prepares a string for a text area output in tests.
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string.
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
 Creates a QTI material tag from a plain text or xhtml text.
 createNewImageFileName ($image_filename)
 _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass=NULL, $manualscoring=FALSE)
 Sets the points, a learner has reached answering the question Additionally objective results are updated.
 getQuestion ()
 Gets the question string of the question object.
 setQuestion ($question="")
 Sets the question string of the question object.
 getQuestionType ()
 Returns the question type of the question.
 getQuestionTypeID ()
 Returns the question type of the question.
 getFeedbackGeneric ($correctness)
 Returns the generic feedback for a given question state.
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor.
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table
getInstances ()
 Gets all instances of the question.
 _needsManualScoring ($question_id)
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id.
_instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id.
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question.
 __get ($value)
 Object getter.
 __set ($key, $value)
 Object setter.
 getNrOfTries ()
 setNrOfTries ($a_nr_of_tries)
 setExportImagePath ($a_path)
 _questionExistsInTest ($question_id, $test_id)
 formatSAQuestion ($a_q)
 Format self assessment question.

Static Public Member Functions

static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question.
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution.
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too)
static _isWorkedThrough ($active_id, $question_id, $pass=NULL)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value.
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not.
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type.
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag.

Protected Member Functions

 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID.
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test)
 onCopy ($source_questionpool_id, $source_question_id)
 Will be called when a question is copied (into another question pool)
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated.
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced.
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)

Protected Attributes

 $id
 $title
 $comment
 $owner
 $author
 $question
 $points
 $est_working_time
 $shuffle
 $test_id
 $obj_id
 $ilias
 $tpl
 $lng
 $outputType
 $suggested_solutions
 $original_id
 $page

Private Attributes

 $nr_of_tries
 Number of tries.
 $arrData
 Associative array to store properties.
 $export_image_path
 (Web) Path to images

Detailed Description

Basic class for all assessment question types.

The assQuestion class defines and encapsulates basic methods and attributes for assessment question types to be used for all parent classes.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id:
class.assQuestion.php 47446 2014-01-22 17:07:12Z bheyser

Definition at line 36 of file class.assQuestion.php.

Constructor & Destructor Documentation

assQuestion::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "" 
)

assQuestion constructor

Parameters
string$titleA title string to describe the question
string$commentA comment string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator
string$questionQuestion text public

Reimplemented in assClozeTest, assTextQuestion, assTextSubset, assNumeric, assFileUpload, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 189 of file class.assQuestion.php.

References $author, $comment, $ilias, $lng, $owner, $question, $title, $tpl, OUTPUT_HTML, setEstimatedWorkingTime(), and setQuestion().

{
global $ilias;
global $lng;
global $tpl;
$this->ilias =& $ilias;
$this->lng =& $lng;
$this->tpl =& $tpl;
$this->original_id = null;
$this->title = $title;
$this->comment = $comment;
$this->page = null;
$this->author = $author;
if (!$this->author)
{
$this->author = $this->ilias->account->fullname;
}
$this->owner = $owner;
if ($this->owner <= 0)
{
$this->owner = $this->ilias->account->id;
}
$this->id = -1;
$this->test_id = -1;
$this->suggested_solutions = array();
$this->shuffle = 1;
$this->nr_of_tries = "";
$this->setEstimatedWorkingTime(0,1,0);
$this->outputType = OUTPUT_HTML;
$this->arrData = array();
}

+ Here is the call graph for this function:

Member Function Documentation

assQuestion::__get (   $value)

Object getter.

Reimplemented in assFileUpload, assErrorText, and assOrderingHorizontal.

Definition at line 3293 of file class.assQuestion.php.

References $ilias, $page, $tpl, getAuthor(), getComment(), getEstimatedWorkingTime(), getId(), getObjId(), getOriginalId(), getOutputType(), getOwner(), getPoints(), getQuestion(), getShuffle(), getSuggestedSolutions(), getTestId(), and getTitle().

{
switch ($value)
{
case "id":
return $this->getId();
break;
case "title":
return $this->getTitle();
break;
case "comment":
return $this->getComment();
break;
case "owner":
return $this->getOwner();
break;
case "author":
return $this->getAuthor();
break;
case "question":
return $this->getQuestion();
break;
case "points":
return $this->getPoints();
break;
case "est_working_time":
return $this->getEstimatedWorkingTime();
break;
case "shuffle":
return $this->getShuffle();
break;
case "test_id":
return $this->getTestId();
break;
case "obj_id":
return $this->getObjId();
break;
case "ilias":
return $this->ilias;
break;
case "tpl":
return $this->tpl;
break;
case "page":
return $this->page;
break;
case "outputType":
return $this->getOutputType();
break;
case "suggested_solutions":
return $this->getSuggestedSolutions();
break;
case "original_id":
return $this->getOriginalId();
break;
default:
if (array_key_exists($value, $this->arrData))
{
return $this->arrData[$value];
}
else
{
return null;
}
break;
}
}

+ Here is the call graph for this function:

assQuestion::__set (   $key,
  $value 
)

Object setter.

Reimplemented in assFileUpload, assErrorText, and assOrderingHorizontal.

Definition at line 3364 of file class.assQuestion.php.

References setAuthor(), setComment(), setEstimatedWorkingTime(), setId(), setObjId(), setOriginalId(), setOutputType(), setOwner(), setPoints(), setQuestion(), setShuffle(), setTestId(), and setTitle().

{
switch ($key)
{
case "id":
$this->setId($value);
break;
case "title":
$this->setTitle($value);
break;
case "comment":
$this->setComment($value);
break;
case "owner":
$this->setOwner($value);
break;
case "author":
$this->setAuthor($value);
break;
case "question":
$this->setQuestion($value);
break;
case "points":
$this->setPoints($value);
break;
case "est_working_time":
if (is_array($value))
{
$this->setEstimatedWorkingTime($value["h"], $value["m"], $value["s"]);
}
break;
case "shuffle":
$this->setShuffle($value);
break;
case "test_id":
$this->setTestId($value);
break;
case "obj_id":
$this->setObjId($value);
break;
case "outputType":
$this->setOutputType($value);
break;
case "original_id":
$this->setOriginalId($value);
break;
case "page":
$this->page =& $value;
break;
default:
$this->arrData[$key] = $value;
break;
}
}

+ Here is the call graph for this function:

static assQuestion::_areAnswered (   $a_user_id,
  $a_question_ids 
)
static

Checks if an array of question ids is answered by an user or not.

Parameters
intuser_id
array$question_idsuser id array
Returns
boolean

Definition at line 2673 of file class.assQuestion.php.

References $ilDB, and $res.

Referenced by ilCourseObjectiveResult\getStatus().

{
global $ilDB;
$res = $ilDB->queryF("SELECT DISTINCT(question_fi) FROM tst_test_result JOIN tst_active ".
"ON (active_id = active_fi) ".
"WHERE " . $ilDB->in('question_fi', $a_question_ids, false, 'integer') .
" AND user_fi = %s",
array('integer'),
array($a_user_id)
);
return ($res->numRows() == count($a_question_ids)) ? true : false;
}

+ Here is the caller graph for this function:

assQuestion::_getInternalLinkHref (   $target = "")

Definition at line 2272 of file class.assQuestion.php.

References $ilDB, and $target_id.

Referenced by getSuggestedSolutionOutput(), and assQuestionGUI\suggestedsolution().

{
global $ilDB;
$linktypes = array(
"lm" => "LearningModule",
"pg" => "PageObject",
"st" => "StructureObject",
"git" => "GlossaryItem",
"mob" => "MediaObject"
);
$href = "";
if (preg_match("/il__(\w+)_(\d+)/", $target, $matches))
{
$type = $matches[1];
$target_id = $matches[2];
include_once "./Services/Utilities/classes/class.ilUtil.php";
switch($linktypes[$matches[1]])
{
case "LearningModule":
$href = "./goto.php?target=" . $type . "_" . $target_id;
break;
case "PageObject":
case "StructureObject":
$href = "./goto.php?target=" . $type . "_" . $target_id;
break;
case "GlossaryItem":
$href = "./goto.php?target=" . $type . "_" . $target_id;
break;
case "MediaObject":
$href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=".$_GET["ref_id"]."&mob_id=".$target_id;
break;
}
}
return $href;
}

+ Here is the caller graph for this function:

assQuestion::_getMaximumPoints (   $question_id)

Returns the maximum points, a learner can reach answering the question.

Parameters
integer$question_idThe database Id of the question
See Also
$points

Definition at line 589 of file class.assQuestion.php.

References $ilDB, $points, $result, and $row.

Referenced by _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), assFileUpload\handleSubmission(), and ilTestScoringGUI\setPointsManual().

{
global $ilDB;
$points = 0;
$result = $ilDB->queryF("SELECT points FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$points = $row["points"];
}
return $points;
}

+ Here is the caller graph for this function:

assQuestion::_getOriginalId (   $question_id)

Returns the original id of a question.

Parameters
integer$question_idThe database id of the question
Returns
integer The database id of the original question public

Definition at line 2315 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by _logAction(), ilObjTest\cloneObject(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assImagemapQuestion\copyObject(), assErrorText\copyObject(), assFlashQuestion\copyObject(), assTextQuestion\copyObject(), assNumeric\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assJavaApplet\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assErrorText\duplicate(), assTextQuestion\duplicate(), assNumeric\duplicate(), assOrderingQuestion\duplicate(), assTextSubset\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assSingleChoice\duplicate(), assJavaApplet\duplicate(), assClozeTest\duplicate(), logAction(), and ilObjTest\logAction().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() > 0)
{
$row = $ilDB->fetchAssoc($result);
if ($row["original_id"] > 0)
{
return $row["original_id"];
}
else
{
return $row["question_id"];
}
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

& assQuestion::_getQuestionInfo (   $question_id)

Returns question information from the database.

Parameters
integer$question_idThe database Id of the question
Returns
array The database row containing the question data

Definition at line 612 of file class.assQuestion.php.

References $ilDB, and $result.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
return $ilDB->fetchAssoc($result);
}
else return array();
}

+ Here is the caller graph for this function:

assQuestion::_getQuestionText (   $a_q_id)

Returns question text.

Parameters
int$a_q_idquestion id

Definition at line 1582 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by ilLMQuestionListTableGUI\fillRow().

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_text FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($a_q_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["question_text"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

assQuestion::_getQuestionTitle (   $question_id)

Returns the question title of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question title private

Definition at line 1693 of file class.assQuestion.php.

References $data, $ilDB, and $result.

Referenced by ilObjAssessmentFolderGUI\exportLogObject(), ilObjectivesAlignmentTableGUI\fillRow(), and ilAssessmentFolderLogTableGUI\fillRow().

{
global $ilDB;
if ($question_id < 1) return "";
$result = $ilDB->queryF("SELECT title FROM qpl_questions WHERE qpl_questions.question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["title"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

assQuestion::_getQuestionType (   $question_id)

Returns the question type of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question type string private

Definition at line 1666 of file class.assQuestion.php.

References $data, $ilDB, and $result.

Referenced by _instanciateQuestion(), _instanciateQuestionGUI(), _needsManualScoring(), and ilObjectivesAlignmentTableGUI\fillRow().

{
global $ilDB;
if ($question_id < 1) return "";
$result = $ilDB->queryF("SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["type_tag"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

static assQuestion::_getQuestionTypeName (   $type_tag)
static

Return the translation for a given question type tag.

Parameters
string$type_tagThe type tag of the question type public

Definition at line 3230 of file class.assQuestion.php.

References $lng, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by ilObjQuestionPoolGUI\addLocatorItems(), ilObjTestGUI\createRandomSelectionObject(), ilCopySelfAssQuestionTableGUI\fillRow(), ilTestQuestionsTableGUI\fillRow(), ilTestQuestionBrowserTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), assQuestionGUI\outQuestionType(), ilObjTestGUI\removeQuestionsForm(), and ilObjQuestionPoolGUI\setTitleAndDescription().

{
if (file_exists("./Modules/TestQuestionPool/classes/class.".$type_tag.".php"))
{
global $lng;
return $lng->txt($type_tag);
}
else
{
global $ilPluginAdmin;
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
if (strcmp($pl->getQuestionType(), $type_tag) == 0)
{
return $pl->getQuestionTypeTranslation();
}
}
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_getReachedPoints (   $active_id,
  $question_id,
  $pass = NULL 
)

Returns the points, a learner has reached answering the question.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$question_idThe database Id of the question

Definition at line 728 of file class.assQuestion.php.

References $ilDB, $pass, $points, $result, $row, and _getSolutionMaxPass().

Referenced by ilTestServiceGUI\getPassListOfAnswersWithScoring(), and getReachedPoints().

{
global $ilDB;
$points = 0;
if (is_null($pass))
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
}
$result = $ilDB->queryF("SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer','integer','integer'),
array($active_id, $question_id, $pass)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$points = $row["points"];
}
return $points;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_getSolutionMaxPass (   $question_id,
  $active_id 
)

Returns the maximum pass a users question solution.

Parameters
returninteger The maximum pass of the users solution public

Definition at line 2525 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by _getReachedPoints(), _isWorkedThrough(), _setReachedPoints(), getSolutionMaxPass(), and ilObjTest\getTextAnswer().

{
/* include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
return $pass;*/
// the following code was the old solution which added the non answered
// questions of a pass from the answered questions of the previous pass
// with the above solution, only the answered questions of the last pass are counted
global $ilDB;
$result = $ilDB->queryF("SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
array('integer','integer'),
array($active_id, $question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["maxpass"];
}
else
{
return 0;
}
}

+ Here is the caller graph for this function:

& assQuestion::_getSuggestedSolution (   $question_id,
  $subquestion_index = 0 
)

Returns a suggested solution for a given subquestion index.

Parameters
integer$question_idThe database Id of the question
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
array A suggested solution array containing the internal link public

Definition at line 689 of file class.assQuestion.php.

References $ilDB, $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
array('integer','integer'),
array($question_id, $subquestion_index)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return array(
"internal_link" => $row["internal_link"],
"import_id" => $row["import_id"]
);
}
else
{
return array();
}
}
static assQuestion::_getSuggestedSolutionCount (   $question_id)
static

Returns the number of suggested solutions associated with a question.

Parameters
integer$question_idThe database Id of the question
Returns
integer The number of suggested solutions

Definition at line 633 of file class.assQuestion.php.

References $ilDB, and $result.

{
global $ilDB;
$result = $ilDB->queryF("SELECT suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($question_id)
);
return $result->numRows();
}
static assQuestion::_getSuggestedSolutionOutput (   $question_id)
static

Returns the output of the suggested solution.

Parameters
integer$question_idThe database Id of the question
Returns
string Suggested solution

Definition at line 650 of file class.assQuestion.php.

References $question, and _instanciateQuestion().

Referenced by ilObjTest\getTestResult().

{
if (!is_object($question)) return "";
return $question->getSuggestedSolutionOutput();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_getTitle (   $a_q_id)

Returns the title of a question.

Parameters
int$a_q_idquestion id

Definition at line 1559 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by ilObjQuestionPoolGUI\assessmentObject(), and ilSCORM2004ScoGUI\sahs_questions().

{
global $ilDB;
$result = $ilDB->queryF("SELECT title FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($a_q_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["title"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

assQuestion::_getTotalAnswers (   $a_q_id)

get number of answers for question id (static) note: do not use $this inside this method

Parameters
int$a_q_idquestion id

Definition at line 1481 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by ilObjQuestionPoolGUI\assessmentObject(), and getTotalAnswers().

{
global $ilDB;
// get all question references to the question id
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
array('integer','integer'),
array($a_q_id, $a_q_id)
);
if ($result->numRows() == 0)
{
return 0;
}
$found_id = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($found_id, $row["question_id"]);
}
$result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
return $result->numRows();
}

+ Here is the caller graph for this function:

assQuestion::_getTotalRightAnswers (   $a_q_id)

get number of answers for question id (static) note: do not use $this inside this method

Parameters
int$a_q_idquestion id

Definition at line 1512 of file class.assQuestion.php.

References $ilDB, $result, $row, and _getMaximumPoints().

Referenced by ilObjQuestionPoolGUI\assessmentObject().

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
array('integer','integer'),
array($a_q_id, $a_q_id)
);
if ($result->numRows() == 0)
{
return 0;
}
$found_id = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($found_id, $row["question_id"]);
}
$result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
$answers = array();
while ($row = $ilDB->fetchAssoc($result))
{
$reached = $row["points"];
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$max = assQuestion::_getMaximumPoints($row["question_fi"]);
array_push($answers, array("reached" => $reached, "max" => $max));
}
$max = 0.0;
$reached = 0.0;
foreach ($answers as $key => $value)
{
$max += $value["max"];
$reached += $value["reached"];
}
if ($max > 0)
{
return $reached / $max;
}
else
{
return 0;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::_includeClass (   $question_type,
  $gui = 0 
)
static

Include the php class file for a given question type.

Parameters
string$question_typeThe type tag of the question type
Returns
integer 0 if the class should be included, 1 if the GUI class should be included public

Definition at line 3201 of file class.assQuestion.php.

References ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by assQuestionGUI\_getQuestionGUI(), _instanciateQuestion(), _instanciateQuestionGUI(), ilObjQuestionPool\createQuestion(), ilObjTest\createQuestionGUI(), and ilQTIParser\handlerParseEndTag().

{
$type = $question_type;
if ($gui) $type .= "GUI";
if (file_exists("./Modules/TestQuestionPool/classes/class.".$type.".php"))
{
include_once "./Modules/TestQuestionPool/classes/class.".$type.".php";
}
else
{
global $ilPluginAdmin;
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
if (strcmp($pl->getQuestionType(), $question_type) == 0)
{
$pl->includeClass("class.".$type.".php");
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& assQuestion::_instanciateQuestion (   $question_id)

Creates an instance of a question with a given question id.

Parameters
integer$question_idThe question id
Returns
object The question instance public

Definition at line 2465 of file class.assQuestion.php.

References $question, _getQuestionType(), and _includeClass().

Referenced by _getSuggestedSolutionOutput(), ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), ilObjTestGUI\copyAndLinkToQuestionpoolObject(), ilPCQuestion\copyPoolQuestionIntoPage(), ilSCORM2004Asset\exportPDFPrepareXmlNFiles(), ilSCORM2004Asset\exportXMLPageObjects(), ilPageObject\newQuestionCopies(), ilSoapTestAdministration\saveQuestion(), and ilSoapTestAdministration\saveQuestionSolution().

{
if (strcmp($question_id, "") != 0)
{
$question_type = assQuestion::_getQuestionType($question_id);
if (!strlen($question_type)) return null;
assQuestion::_includeClass($question_type);
$question = new $question_type();
$question->loadFromDb($question_id);
return $question;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& assQuestion::_instanciateQuestionGUI (   $question_id)

Creates an instance of a question gui with a given question id.

Parameters
integer$question_idThe question id
Returns
object The question gui instance public

Definition at line 3260 of file class.assQuestion.php.

References _getQuestionType(), and _includeClass().

Referenced by ilObjTestGUI\copyQuestionObject(), ilObjQuestionPool\createQuestion(), and ilQuestionPoolPrintViewTableGUI\fillRow().

{
if (strcmp($question_id, "") != 0)
{
$question_type = assQuestion::_getQuestionType($question_id);
$question_type_gui = $question_type . "GUI";
assQuestion::_includeClass($question_type, 1);
$question_gui = new $question_type_gui();
$question_gui->object->loadFromDb($question_id);
return $question_gui;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_isUsedInRandomTest (   $question_id = "")

Checks whether the question is used in a random test or not.

Returns
boolean The number how often the question is used in a random test public

Definition at line 2591 of file class.assQuestion.php.

References $ilDB, and $result.

Referenced by ilObjQuestionPool\getDeleteableQuestionDetails().

{
global $ilDB;
if ($question_id < 1) return 0;
$result = $ilDB->queryF("SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s",
array('integer'),
array($question_id)
);
return $result->numRows();
}

+ Here is the caller graph for this function:

static assQuestion::_isWorkedThrough (   $active_id,
  $question_id,
  $pass = NULL 
)
static

Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$question_idThe database Id of the question

Definition at line 2642 of file class.assQuestion.php.

References $ilDB, $pass, $points, $result, and _getSolutionMaxPass().

Referenced by ilObjTest\getAnsweredQuestionCount().

{
global $ilDB;
$points = 0;
if (is_null($pass))
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
}
$result = $ilDB->queryF("SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer','integer','integer'),
array($active_id, $question_id, $pass)
);
if ($result->numRows())
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_isWriteable (   $question_id,
  $user_id 
)

Returns true if the question is writeable by a certain user.

Parameters
integer$question_idThe database id of the question
integer$user_idThe database id of the user
Returns
boolean True, if the question exists, otherwise False public

Definition at line 2559 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by assQuestionGUI\save(), assQuestionGUI\saveEdit(), assQuestionGUI\saveFeedback(), assQuestionGUI\saveReturn(), and assQuestionGUI\suggestedsolution().

{
global $ilDB;
if (($question_id < 1) || ($user_id < 1))
{
return false;
}
$result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$qpl_object_id = $row["obj_fi"];
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
return ilObjQuestionPool::_isWriteable($qpl_object_id, $user_id);
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

assQuestion::_logAction (   $logtext = "",
  $active_id = "",
  $question_id = "" 
)

Logs an action into the Test&Assessment log.

Parameters
string$logtextThe log text
integer$question_idIf given, saves the question id to the database public

Definition at line 969 of file class.assQuestion.php.

References $original_id, ilObjAssessmentFolder\_addLog(), ilObjTest\_getObjectIDFromActiveID(), and _getOriginalId().

Referenced by _setReachedPoints().

{
global $ilUser;
if (strcmp($question_id, "") != 0)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
}
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
ilObjAssessmentFolder::_addLog($ilUser->id, ilObjTest::_getObjectIDFromActiveID($active_id), $logtext, $question_id, $original_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_needsManualScoring (   $question_id)

Definition at line 3154 of file class.assQuestion.php.

References ilObjAssessmentFolder\_getManualScoringTypes(), and _getQuestionType().

Referenced by ilTestExpressPageObjectGUI\insertQuestions(), and ilObjTestGUI\insertQuestionsObject().

{
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$questiontype = assQuestion::_getQuestionType($question_id);
if (in_array($questiontype, $scoring))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_questionExists (   $question_id)

Returns true if the question already exists in the database.

Parameters
integer$question_idThe database id of the question
Returns
boolean True, if the question exists, otherwise False public

Definition at line 2405 of file class.assQuestion.php.

References $ilDB, and $result.

{
global $ilDB;
if ($question_id < 1)
{
return false;
}
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
return true;
}
else
{
return false;
}
}
assQuestion::_questionExistsInPool (   $question_id)

Returns true if the question already exists in the database and is assigned to a question pool.

Parameters
integer$question_idThe database id of the question
Returns
boolean True, if the question exists, otherwise False public

Definition at line 2435 of file class.assQuestion.php.

References $ilDB, and $result.

Referenced by assQuestionGUI\outQuestionType().

{
global $ilDB;
if ($question_id < 1)
{
return false;
}
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions INNER JOIN object_data ON obj_fi = obj_id WHERE question_id = %s AND type = 'qpl'",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

assQuestion::_questionExistsInTest (   $question_id,
  $test_id 
)

Definition at line 3434 of file class.assQuestion.php.

References $ilDB, $result, and $test_id.

Referenced by assQuestionGUI\save(), and assQuestionGUI\saveReturn().

{
global $ilDB;
if ($question_id < 1)
{
return false;
}
$result = $ilDB->queryF("SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
array('integer', 'integer'),
array($question_id, $test_id)
);
if ($result->numRows() == 1)
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

assQuestion::_resolveInternalLink (   $internal_link)

Definition at line 2184 of file class.assQuestion.php.

References ilInternalLink\_getIdForImportId(), and ilLMObject\_getIdForImportId().

Referenced by _resolveIntLinks(), and setSuggestedSolution().

{
if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
{
include_once "./Services/COPage/classes/class.ilInternalLink.php";
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
switch ($matches[2])
{
case "lm":
$resolved_link = ilLMObject::_getIdForImportId($internal_link);
break;
case "pg":
$resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
break;
case "st":
$resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
break;
case "git":
$resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
break;
case "mob":
$resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
break;
}
if (strcmp($resolved_link, "") == 0)
{
$resolved_link = $internal_link;
}
}
else
{
$resolved_link = $internal_link;
}
return $resolved_link;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_resolveIntLinks (   $question_id)

Definition at line 2221 of file class.assQuestion.php.

References $ilDB, $result, $row, ilInternalLink\_deleteAllLinksOfSource(), _resolveInternalLink(), and ilInternalLink\_saveLink().

Referenced by ilContObjParser\processPagesToParse().

{
global $ilDB;
$resolvedlinks = 0;
$result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$internal_link = $row["internal_link"];
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$resolved_link = assQuestion::_resolveInternalLink($internal_link);
if (strcmp($internal_link, $resolved_link) != 0)
{
// internal link was resolved successfully
$affectedRows = $ilDB->manipulateF("UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
array('text','integer'),
array($resolved_link, $row["suggested_solution_id"])
);
$resolvedlinks++;
}
}
}
if ($resolvedlinks)
{
// there are resolved links -> reenter theses links to the database
// delete all internal links from the database
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches))
{
ilInternalLink::_saveLink("qst", $question_id, $matches[2], $matches[3], $matches[1]);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_setReachedPoints (   $active_id,
  $question_id,
  $points,
  $maxpoints,
  $pass = NULL,
  $manualscoring = FALSE 
)

Sets the points, a learner has reached answering the question Additionally objective results are updated.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$pointsThe points the user has reached answering the question
Returns
boolean true on success, otherwise false public

Definition at line 2815 of file class.assQuestion.php.

References $ilDB, $lng, $pass, $points, $result, $row, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTestAccess\_getParticipantData(), _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), _logAction(), ilCourseObjectiveResult\_updateObjectiveResult(), and _updateTestPassResults().

Referenced by assFileUpload\handleSubmission(), and ilTestScoringGUI\setPointsManual().

{
global $ilDB;
if ($points <= $maxpoints)
{
if (is_null($pass))
{
$pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
}
// retrieve the already given points
$old_points = 0;
$result = $ilDB->queryF("SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer','integer','integer'),
array($active_id, $question_id, $pass)
);
$manual = ($manualscoring) ? 1 : 0;
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
$old_points = $row["points"];
$affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('float', 'integer', 'integer', 'integer', 'integer', 'integer'),
array($points, $manual, time(), $active_id, $question_id, $pass)
);
}
else
{
$next_id = $ilDB->nextId('tst_test_result');
$affectedRows = $ilDB->manipulateF("INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer', 'integer','integer', 'float', 'integer', 'integer','integer'),
array($next_id, $active_id, $question_id, $points, $pass, $manual, time())
);
}
// finally update objective result
include_once "./Modules/Test/classes/class.ilObjTest.php";
include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
{
global $lng, $ilUser;
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$username = ilObjTestAccess::_getParticipantData($active_id);
assQuestion::_logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
}
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_updateTestPassResults (   $active_id,
  $pass 
)

Definition at line 886 of file class.assQuestion.php.

References $data, $ilDB, $pass, $result, $row, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), ilObjTest\_getWorkingTimeOfParticipantForPass(), and _updateTestResultCache().

Referenced by ilObjTestAccess\_isPassed(), _setReachedPoints(), calculateResultsFromSolution(), ilTestOutputGUI\redirectQuestion(), and assTextQuestion\setReachedPoints().

{
global $ilDB;
include_once "./Modules/Test/classes/class.ilObjTest.php";
// update test pass results
$result = $ilDB->queryF("SELECT SUM(points) reachedpoints, COUNT(question_fi) answeredquestions FROM tst_test_result WHERE active_fi = %s AND pass = %s",
array('integer','integer'),
array($active_id, $pass)
);
if ($result->numRows() > 0)
{
$row = $ilDB->fetchAssoc($result);
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_pass_result WHERE active_fi = %s AND pass = %s",
array('integer','integer'),
array($active_id, $pass)
);
$affectedRows = $ilDB->manipulateF("INSERT INTO tst_pass_result (active_fi, pass, points, maxpoints, questioncount, answeredquestions, workingtime, tstamp) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)",
array(
'integer',
'integer',
'float',
'float',
'integer',
'integer',
'integer',
'integer'
),
array(
$active_id,
strlen($pass) ? $pass : 0,
($row["reachedpoints"]) ? $row["reachedpoints"] : 0,
$data["points"],
$data["count"],
$row["answeredquestions"],
$time,
time()
)
);
}
return array(
'active_fi' => $active_id,
'pass' => $pass,
'points' => ($row["reachedpoints"]) ? $row["reachedpoints"] : 0,
'maxpoints' => $data["points"],
'questioncount' => $data["count"],
'answeredquestions' => $row["answeredquestions"],
'workingtime' => $time,
'tstamp' => time()
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_updateTestResultCache (   $active_id)

Definition at line 839 of file class.assQuestion.php.

References $ilDB, $pass, $result, $row, ASS_MarkSchema\_getMatchingMarkFromActiveId(), and ilObjTest\_getResultPass().

Referenced by ilObjTestAccess\_getPassedUsers(), ilObjTestAccess\_isPassed(), _updateTestPassResults(), and ilObjTest\getResultsForActiveId().

{
global $ilDB;
include_once "./Modules/Test/classes/class.ilObjTest.php";
$result = $ilDB->queryF("SELECT tst_pass_result.* FROM tst_pass_result WHERE active_fi = %s AND pass = %s",
array('integer','integer'),
array($active_id, $pass)
);
$row = $ilDB->fetchAssoc($result);
$max = $row['maxpoints'];
$reached = $row['points'];
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
$mark = ASS_MarkSchema::_getMatchingMarkFromActiveId($active_id, $percentage);
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_result_cache WHERE active_fi = %s",
array('integer'),
array($active_id)
);
$affectedRows = $ilDB->manipulateF("INSERT INTO tst_result_cache (active_fi, pass, max_points, reached_points, mark_short, mark_official, passed, failed, tstamp) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)",
array(
'integer',
'integer',
'float',
'float',
'text',
'text',
'integer',
'integer',
'integer'
),
array(
$active_id,
strlen($pass) ? $pass : 0,
strlen($max) ? $max : 0,
strlen($reached) ? $reached : 0,
strlen($mark["short_name"]) ? $mark["short_name"] : " ",
strlen($mark["official_name"]) ? $mark["official_name"] : " ",
($mark["passed"]) ? 1 : 0,
(!$mark["passed"]) ? 1 : 0,
time()
)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::addQTIMaterial ( $a_xml_writer,
  $a_material,
  $close_material_tag = TRUE,
  $add_mobs = TRUE 
)

Creates a QTI material tag from a plain text or xhtml text.

Parameters
object$a_xml_writerReference to the ILIAS XML writer
string$a_materialplain text or html text containing the material
Returns
string QTI material tag public

Definition at line 2757 of file class.assQuestion.php.

References $mobs, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), getId(), and isHTML().

{
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$a_xml_writer->xmlStartTag("material");
$attrs = array(
"texttype" => "text/plain"
);
if ($this->isHTML($a_material))
{
$attrs["texttype"] = "text/xhtml";
}
$a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
if ($add_mobs)
{
foreach ($mobs as $mob)
{
$moblabel = "il_" . IL_INST_ID . "_mob_" . $mob;
if (strpos($a_material, "mm_$mob") !== FALSE)
{
{
$mob_obj =& new ilObjMediaObject($mob);
$imgattrs = array(
"label" => $moblabel,
"uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
);
}
$a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
}
}
}
if ($close_material_tag) $a_xml_writer->xmlEndTag("material");
}

+ Here is the call graph for this function:

assQuestion::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $points = 0 
)

Returns the points, a learner has reached answering the question The points are calculated from the given answers including checks for all special scoring options in the test container.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question public

Reimplemented in assClozeTest.

Definition at line 2612 of file class.assQuestion.php.

References $points, ilObjTest\_getCountSystem(), ilObjTest\_getScoreCutting(), and getMaximumPoints().

Referenced by calculateResultsFromSolution().

{
include_once "./Modules/Test/classes/class.ilObjTest.php";
$count_system = ilObjTest::_getCountSystem($active_id);
if ($count_system == 1)
{
if ($points != $this->getMaximumPoints())
{
$points = 0;
}
}
$score_cutting = ilObjTest::_getScoreCutting($active_id);
if ($score_cutting == 0)
{
if ($points < 0)
{
$points = 0;
}
}
return $points;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::calculateResultsFromSolution (   $active_id,
  $pass = NULL 
)

Calculates the question results from a previously saved question solution.

Parameters
integer$active_idActive id of the user
integer$passTest pass

Definition at line 780 of file class.assQuestion.php.

References $ilDB, $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), ilCourseObjectiveResult\_updateObjectiveResult(), _updateTestPassResults(), calculateReachedPoints(), getId(), and logAction().

Referenced by saveWorkingData().

{
global $ilDB;
global $ilUser;
if (is_null($pass))
{
include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
}
$reached_points = $this->calculateReachedPoints($active_id, $pass);
if (is_null($reached_points)) $reached_points = 0;
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array("integer", "integer", "integer"),
array(
$active_id,
$this->getId(),
)
);
$next_id = $ilDB->nextId("tst_test_result");
$affectedRows = $ilDB->manipulateF("INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, pass, points, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
array("integer","integer", "integer", "integer", "float", "integer"),
array(
$next_id,
$active_id,
$this->getId(),
$reached_points,
time()
)
);
include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
{
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_user_answered_question", ilObjAssessmentFolder::_getLogLanguage()), $reached_points), $active_id, $this->getId());
}
// update test pass results
$this->_updateTestPassResults($active_id, $pass);
// Update objective status
include_once 'Modules/Course/classes/class.ilCourseObjectiveResult.php';
ilCourseObjectiveResult::_updateObjectiveResult($ilUser->getId(),$active_id,$this->getId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::cleanupMediaObjectUsage ( )

synchronises appearances of media objects in the question with media object usage table

Definition at line 3099 of file class.assQuestion.php.

References ilRTE\_cleanupMediaObjectUsage(), getId(), and getRTETextWithMediaObjects().

Referenced by saveToDb().

{
$combinedtext = $this->getRTETextWithMediaObjects();
include_once("./Services/RTE/classes/class.ilRTE.php");
ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::copyPageOfQuestion (   $a_q_id)

Definition at line 1638 of file class.assQuestion.php.

References $page.

Referenced by syncWithOriginal().

{
if ($a_q_id > 0)
{
include_once "./Services/COPage/classes/class.ilPageObject.php";
$page = new ilPageObject("qpl", $a_q_id);
$xml = str_replace("il__qst_".$a_q_id, "il__qst_".$this->id, $page->getXMLContent());
$this->page->setXMLContent($xml);
$this->page->saveMobUsage($xml);
$this->page->updateFromXML();
}
}

+ Here is the caller graph for this function:

assQuestion::copySuggestedSolutionFiles (   $source_questionpool_id,
  $source_question_id 
)
protected

Definition at line 2068 of file class.assQuestion.php.

References $filename, $ilLog, getSuggestedSolutionPath(), and ilUtil\makeDirParents().

Referenced by onCopy().

{
global $ilLog;
foreach ($this->suggested_solutions as $index => $solution)
{
if (strcmp($solution["type"], "file") == 0)
{
$filepath = $this->getSuggestedSolutionPath();
$filepath_original = str_replace("/$this->obj_id/$this->id/solution", "/$source_questionpool_id/$source_question_id/solution", $filepath);
if (!file_exists($filepath))
{
}
$filename = $solution["value"]["name"];
if (strlen($filename))
{
if (!copy($filepath_original . $filename, $filepath . $filename))
{
$ilLog->write("File could not be copied!!!!", $ilLog->ERROR);
$ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::copyXHTMLMediaObjectsOfQuestion (   $a_q_id)

Definition at line 1601 of file class.assQuestion.php.

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_saveUsage(), and getId().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $a_q_id);
foreach ($mobs as $mob)
{
ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
}
}

+ Here is the call graph for this function:

assQuestion::createNewImageFileName (   $image_filename)

Definition at line 2794 of file class.assQuestion.php.

{
$extension = "";
if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $image_filename, $matches))
{
$extension = "." . $matches[1];
}
$image_filename = md5($image_filename) . $extension;
return $image_filename;
}
assQuestion::createNewQuestion (   $a_create_page = true)

Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.

Returns
integer ID of the new question

Definition at line 1761 of file class.assQuestion.php.

References $_GET, $_POST, $ilDB, $obj_id, ilObject\_lookupObjId(), createPageObject(), getAuthor(), getEstimatedWorkingTime(), getId(), getObjId(), getQuestionTypeID(), and setId().

{
global $ilDB, $ilUser;
$complete = "0";
$estw_time = $this->getEstimatedWorkingTime();
$estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
$obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($_GET["ref_id"])) ? $_GET["ref_id"] : $_POST["sel_qpl"])) : $this->getObjId();
if ($obj_id > 0)
{
if($a_create_page)
{
$tstamp = 0;
}
else
{
// question pool must not try to purge
$tstamp = time();
}
$next_id = $ilDB->nextId('qpl_questions');
$affectedRows = $ilDB->insert("qpl_questions", array(
"question_id" => array("integer", $next_id),
"question_type_fi" => array("integer", $this->getQuestionTypeID()),
"obj_fi" => array("integer", $obj_id),
"title" => array("text", NULL),
"description" => array("text", NULL),
"author" => array("text", $this->getAuthor()),
"owner" => array("integer", $ilUser->getId()),
"question_text" => array("clob", NULL),
"points" => array("float", 0),
"nr_of_tries" => array("integer", 1),
"working_time" => array("text", $estw_time),
"complete" => array("text", $complete),
"created" => array("integer", time()),
"original_id" => array("integer", NULL),
"tstamp" => array("integer", $tstamp)
));
$this->setId($next_id);
if($a_create_page)
{
// create page object of question
$this->createPageObject();
}
}
return $this->getId();
}

+ Here is the call graph for this function:

assQuestion::createPageObject ( )

create page object of question

Definition at line 1624 of file class.assQuestion.php.

References getId(), and getObjId().

Referenced by createNewQuestion(), saveQuestionDataToDb(), and syncWithOriginal().

{
$qpl_id = $this->getObjId();
include_once "./Services/COPage/classes/class.ilPageObject.php";
$this->page = new ilPageObject("qpl", 0);
$this->page->setId($this->getId());
$this->page->setParentId($qpl_id);
$this->page->setXMLContent("<PageObject><PageContent>".
"<Question QRef=\"il__qst_".$this->getId()."\"/>".
"</PageContent></PageObject>");
$this->page->create();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::createRandomSolution (   $test_id,
  $user_id 
)

Reimplemented in assSingleChoice, and assTextQuestion.

Definition at line 2394 of file class.assQuestion.php.

{
}
assQuestion::delete (   $question_id)

Deletes a question and all materials from the database.

Parameters
integer$question_idThe database id of the question private

Definition at line 1340 of file class.assQuestion.php.

References $ilDB, $ilLog, $mobs, $obj_id, $result, $row, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), ilUtil\delDir(), deleteAdditionalTableData(), deleteAnswers(), deletePageOfQuestion(), and getObjId().

{
global $ilDB, $ilLog;
if ($question_id < 1) return true; // nothing to do
$result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$obj_id = $row["obj_fi"];
}
else
{
return true; // nothing to do
}
try
{
$this->deletePageOfQuestion($question_id);
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Could not delete page of question $question_id: $e");
return false;
}
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($affectedRows == 0) return false;
try
{
$this->deleteAdditionalTableData($question_id);
$this->deleteAnswers($question_id);
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Could not delete additional table data of question $question_id: $e");
return false;
}
try
{
// delete the question in the tst_test_question table (list of test questions)
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_test_question WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Could not delete delete question $question_id from a test: $e");
return false;
}
try
{
// delete suggested solutions contained in the question
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
return false;
}
try
{
$directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
return false;
}
try
{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
// remaining usages are not in text anymore -> delete them
// and media objects (note: delete method of ilObjMediaObject
// checks whether object is used in another context; if yes,
// the object is not deleted!)
foreach($mobs as $mob)
{
ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
{
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->delete();
}
}
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Error deleting the media objects of question $question_id: $e");
return false;
}
try
{
// update question count of question pool
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
}
catch (Exception $e)
{
$ilLog->write("EXCEPTION: Error updating the question pool question count of question pool " . $this->getObjId() . " when deleting question $question_id: $e");
return false;
}
return true;
}

+ Here is the call graph for this function:

assQuestion::deleteAdditionalTableData (   $question_id)

Deletes datasets from the additional question table in the database.

Parameters
integer$question_idThe question id which should be deleted in the additional question table public

Definition at line 1291 of file class.assQuestion.php.

References $ilDB, and getAdditionalTableName().

Referenced by delete().

{
global $ilDB;
$additional_table_name = $this->getAdditionalTableName();
if (is_array($additional_table_name))
{
foreach ($additional_table_name as $table)
{
if (strlen($table))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM $table WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
}
}
else
{
if (strlen($additional_table_name))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM $additional_table_name WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::deleteAnswers (   $question_id)

Deletes datasets from answers tables.

Parameters
integer$question_idThe question id which should be deleted in the answers table public

Reimplemented in assFileUpload, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 1256 of file class.assQuestion.php.

References $ilDB, and getAnswerTableName().

Referenced by delete().

{
global $ilDB;
$answer_table_name = $this->getAnswerTableName();
if (is_array($answer_table_name))
{
foreach ($answer_table_name as $table)
{
if (strlen($table))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM $table WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
}
}
else
{
if (strlen($answer_table_name))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM $answer_table_name WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::deletePageOfQuestion (   $question_id)
protected

Deletes the page object of a question with a given ID.

Parameters
integer$question_idThe database id of the question protected

Definition at line 1326 of file class.assQuestion.php.

References $page.

Referenced by delete(), and syncWithOriginal().

{
include_once "./Services/COPage/classes/class.ilPageObject.php";
$page = new ilPageObject("qpl", $question_id);
$page->delete();
return true;
}

+ Here is the caller graph for this function:

assQuestion::deleteSuggestedSolutions ( )

Deletes all suggestes solutions in the database.

Definition at line 1921 of file class.assQuestion.php.

References $ilDB, ilInternalLink\_deleteAllLinksOfSource(), ilUtil\delDir(), getId(), and getSuggestedSolutionPath().

{
global $ilDB;
// delete the links in the qpl_sol_sug table
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
// delete the links in the int_link table
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$this->suggested_solutions = array();
}

+ Here is the call graph for this function:

assQuestion::duplicateSuggestedSolutionFiles (   $parent_id,
  $question_id 
)
protected

Duplicates the files of a suggested solution if the question is duplicated.

Definition at line 2006 of file class.assQuestion.php.

References $filename, $ilLog, getSuggestedSolutionPath(), and ilUtil\makeDirParents().

Referenced by onDuplicate().

{
global $ilLog;
foreach ($this->suggested_solutions as $index => $solution)
{
if (strcmp($solution["type"], "file") == 0)
{
$filepath = $this->getSuggestedSolutionPath();
$filepath_original = str_replace(
"/{$this->obj_id}/{$this->id}/solution",
"/$parent_id/$question_id/solution",
$filepath
);
if (!file_exists($filepath))
{
}
$filename = $solution["value"]["name"];
if (strlen($filename))
{
if (!copy($filepath_original . $filename, $filepath . $filename))
{
$ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
$ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::formatSAQuestion (   $a_q)

Format self assessment question.

Parameters
@return

Definition at line 3463 of file class.assQuestion.php.

References ilRTE\_replaceMediaObjectImageSrc(), and getQuestion().

Referenced by assOrderingHorizontal\toJSON(), assTextQuestion\toJSON(), assTextSubset\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
include_once("./Services/RTE/classes/class.ilRTE.php");
$a_q = nl2br((string) ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0));
$a_q = str_replace("</li><br />", "</li>", $a_q);
$a_q = str_replace("</li><br>", "</li>", $a_q);
return $a_q;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::fromXML ( $item,
$questionpool_id,
$tst_id,
$tst_object,
$question_counter,
$import_mapping 
)

Receives parameters from a QTI parser and creates a valid ILIAS question object.

Parameters
object$itemThe QTI item object
integer$questionpool_idThe id of the parent questionpool
integer$tst_idThe id of the parent test if the question is part of a test
object$tst_objectA reference to the parent test object
integer$question_counterA reference to a question counter to count the questions of an imported question pool
array$import_mappingAn array containing references to included ILIAS objects public

Reimplemented in assFileUpload, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 241 of file class.assQuestion.php.

References getQuestionType().

{
include_once "./Modules/TestQuestionPool/classes/import/qti12/class." . $this->getQuestionType() . "Import.php";
$classname = $this->getQuestionType() . "Import";
$import = new $classname($this);
$import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
}

+ Here is the call graph for this function:

assQuestion::getActiveUserData (   $active_id)

Returns the user id and the test id for a given active id.

Parameters
integer$active_idActive id for a test/user
Returns
array Result array containing the user_id and test_id public

Definition at line 3176 of file class.assQuestion.php.

References $ilDB, $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM tst_active WHERE active_id = %s",
array('integer'),
array($active_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return array("user_id" => $row["user_fi"], "test_id" => $row["test_fi"]);
}
else
{
return array();
}
}
assQuestion::getAdditionalTableName ( )

Returns the name of the additional question data table in the database.

Returns
string The additional table name public

Reimplemented in assClozeTest, assMatchingQuestion, assOrderingQuestion, assJavaApplet, assSingleChoice, assMultipleChoice, assImagemapQuestion, assTextSubset, assFileUpload, assTextQuestion, assNumeric, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 1234 of file class.assQuestion.php.

Referenced by deleteAdditionalTableData().

{
return "";
}

+ Here is the caller graph for this function:

assQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name public

Reimplemented in assClozeTest, assMatchingQuestion, assOrderingQuestion, assSingleChoice, assMultipleChoice, assImagemapQuestion, assTextSubset, assFileUpload, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 1245 of file class.assQuestion.php.

Referenced by deleteAnswers().

{
return "";
}

+ Here is the caller graph for this function:

assQuestion::getAuthor ( )

Gets the authors name of the assQuestion object.

Returns
string The string containing the name of the questions author public
See Also
$author

Definition at line 542 of file class.assQuestion.php.

References $author.

Referenced by __get(), createNewQuestion(), assClozeTest\isComplete(), and saveQuestionDataToDb().

{
return $this->author;
}

+ Here is the caller graph for this function:

assQuestion::getComment ( )

Gets the comment string of the assQuestion object.

Returns
string The comment string to describe the question public
See Also
$comment

Definition at line 491 of file class.assQuestion.php.

References $comment.

Referenced by __get(), and saveQuestionDataToDb().

{
}

+ Here is the caller graph for this function:

assQuestion::getEstimatedWorkingTime ( )

Gets the estimated working time of a question.

Returns
array Estimated Working Time of a question public
See Also
$est_working_time

Definition at line 526 of file class.assQuestion.php.

References $est_working_time.

Referenced by __get(), createNewQuestion(), and saveQuestionDataToDb().

{
if (!$this->est_working_time)
{
$this->est_working_time = array("h" => 0, "m" => 0, "s" => 0);
}
}

+ Here is the caller graph for this function:

assQuestion::getFeedbackGeneric (   $correctness)

Returns the generic feedback for a given question state.

The state is either the complete solution of the question or at least one incorrect answer

Parameters
integer$correctness0 for at least one incorrect answer, 1 for the correct solution
Returns
string Feedback text public

Definition at line 2986 of file class.assQuestion.php.

References $ilDB, $result, $row, ilRTE\_replaceMediaObjectImageSrc(), and getId().

Referenced by getRTETextWithMediaObjects(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
global $ilDB;
$feedback = "";
$result = $ilDB->queryF("SELECT * FROM qpl_fb_generic WHERE question_fi = %s AND correctness = %s",
array('integer', 'text'),
array($this->getId(), $correctness)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
include_once("./Services/RTE/classes/class.ilRTE.php");
$feedback = ilRTE::_replaceMediaObjectImageSrc($row["feedback"], 1);
}
return $feedback;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getFlashPath ( )

Returns the image path for web accessable flash files of a question.

The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/flash

public

Definition at line 1054 of file class.assQuestion.php.

Referenced by assFlashQuestion\copyApplet(), assFlashQuestion\deleteApplet(), assFlashQuestion\duplicateApplet(), assFlashQuestion\moveUploadedFile(), and assFlashQuestion\saveToDb().

{
return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/flash/";
}

+ Here is the caller graph for this function:

assQuestion::getFlashPathWeb ( )

Returns the web image path for web accessable flash applications of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/flash

public

Definition at line 1110 of file class.assQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/flash/";
}

+ Here is the call graph for this function:

assQuestion::getId ( )

Gets the id of the assQuestion object.

Returns
integer The id of the assQuestion object public
See Also
$id

Definition at line 455 of file class.assQuestion.php.

References $id.

Referenced by __get(), addQTIMaterial(), assOrderingHorizontal\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assFlashQuestion\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assImagemapQuestion\calculateReachedPoints(), assOrderingQuestion\calculateReachedPoints(), assJavaApplet\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assClozeTest\calculateReachedPoints(), calculateResultsFromSolution(), assMatchingQuestion\checkSaveData(), cleanupMediaObjectUsage(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assImagemapQuestion\copyObject(), assErrorText\copyObject(), assFlashQuestion\copyObject(), assTextQuestion\copyObject(), assNumeric\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assJavaApplet\copyObject(), assClozeTest\copyObject(), copyXHTMLMediaObjectsOfQuestion(), createNewQuestion(), createPageObject(), deleteSuggestedSolutions(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assErrorText\duplicate(), assTextQuestion\duplicate(), assNumeric\duplicate(), assOrderingQuestion\duplicate(), assTextSubset\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assSingleChoice\duplicate(), assJavaApplet\duplicate(), assClozeTest\duplicate(), getFeedbackGeneric(), assImagemapQuestion\getFeedbackSingleAnswer(), assMultipleChoice\getFeedbackSingleAnswer(), assSingleChoice\getFeedbackSingleAnswer(), assFileUpload\getFileUploadPath(), assFileUpload\getFileUploadPathWeb(), getInstances(), assJavaApplet\getReachedInformation(), getReachedPoints(), getSolutionMaxPass(), getSolutionValues(), assFileUpload\getUploadedFiles(), assFileUpload\handleSubmission(), assFileUpload\hasFileUploads(), isInUse(), loadFromDb(), assOrderingHorizontal\moveRight(), saveQuestionDataToDb(), assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assFileUpload\saveToDb(), assNumeric\saveToDb(), assTextSubset\saveToDb(), assMultipleChoice\saveToDb(), assTextQuestion\saveToDb(), assOrderingQuestion\saveToDb(), assSingleChoice\saveToDb(), assImagemapQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assClozeTest\saveToDb(), assJavaApplet\saveToDb(), saveToDb(), assOrderingHorizontal\saveWorkingData(), assErrorText\saveWorkingData(), assNumeric\saveWorkingData(), assTextQuestion\saveWorkingData(), assFileUpload\saveWorkingData(), assTextSubset\saveWorkingData(), assSingleChoice\saveWorkingData(), assMultipleChoice\saveWorkingData(), assImagemapQuestion\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), assClozeTest\saveWorkingData(), setNewOriginalId(), assTextQuestion\setReachedPoints(), syncWithOriginal(), syncXHTMLMediaObjectsOfQuestion(), assErrorText\toggleSelection(), assOrderingHorizontal\toJSON(), assTextQuestion\toJSON(), assTextSubset\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
return $this->id;
}

+ Here is the caller graph for this function:

assQuestion::getImagePath (   $question_id = null,
  $object_id = null 
)

Returns the image path for web accessable images of a question.

The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 1033 of file class.assQuestion.php.

References $id, and $obj_id.

Referenced by assOrderingQuestion\cleanImagefiles(), assImagemapQuestion\copyImage(), assOrderingQuestion\copyImages(), assMatchingQuestion\copyImages(), assMultipleChoice\copyImages(), assSingleChoice\copyImages(), assErrorText\createErrorTextOutput(), assMultipleChoice\deleteImage(), assSingleChoice\deleteImage(), assImagemapQuestion\deleteImage(), assOrderingQuestion\deleteImagefile(), assMatchingQuestion\deleteImagefile(), assImagemapQuestion\duplicateImage(), assOrderingQuestion\duplicateImages(), assMatchingQuestion\duplicateImages(), assMultipleChoice\duplicateImages(), assSingleChoice\duplicateImages(), assMultipleChoice\loadFromDb(), assSingleChoice\loadFromDb(), assMultipleChoice\rebuildThumbnails(), assSingleChoice\rebuildThumbnails(), assOrderingQuestion\rebuildThumbnails(), assMatchingQuestion\rebuildThumbnails(), assMultipleChoice\saveToDb(), assSingleChoice\saveToDb(), assMatchingQuestion\setExportDetailsXLS(), assOrderingQuestion\setImageFile(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), assMatchingQuestion\setImageFile(), assImagemapQuestion\setImageFilename(), assMultipleChoice\syncImages(), and assSingleChoice\syncImages().

{
if( $question_id === null)
{
$question_id = $this->id;
}
if( $object_id === null)
{
$object_id = $this->obj_id;
}
return CLIENT_WEB_DIR . "/assessment/$object_id/$question_id/images/";
}

+ Here is the caller graph for this function:

assQuestion::getImagePathWeb ( )

Returns the web image path for web accessable images of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 1090 of file class.assQuestion.php.

References $export_image_path, ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), and assSingleChoice\toJSON().

{
if(!$this->export_image_path)
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/images/";
}
else
{
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& assQuestion::getInstances ( )

Gets all instances of the question.

Returns
array All instances of question and its copies

Definition at line 3111 of file class.assQuestion.php.

References $ilDB, $result, $row, ilObject\_getAllReferences(), ilObjTest\_lookupAuthor(), ilObject\_lookupTitle(), and getId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s",
array("integer"),
array($this->getId())
);
$instances = array();
$ids = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($ids, $row["question_id"]);
}
foreach ($ids as $question_id)
{
// check non random tests
$result = $ilDB->queryF("SELECT tst_tests.obj_fi FROM tst_tests, tst_test_question WHERE tst_test_question.question_fi = %s AND tst_test_question.test_fi = tst_tests.test_id",
array("integer"),
array($question_id)
);
while ($row = $ilDB->fetchAssoc($result))
{
$instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
}
// check random tests
$result = $ilDB->queryF("SELECT tst_tests.obj_fi FROM tst_tests, tst_test_rnd_qst, tst_active WHERE tst_test_rnd_qst.active_fi = tst_active.active_id AND tst_test_rnd_qst.question_fi = %s AND tst_tests.test_id = tst_active.test_fi",
array("integer"),
array($question_id)
);
while ($row = $ilDB->fetchAssoc($result))
{
$instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
}
}
include_once "./Modules/Test/classes/class.ilObjTest.php";
foreach ($instances as $key => $value)
{
$instances[$key] = array("obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key));
}
return $instances;
}

+ Here is the call graph for this function:

assQuestion::getJavaPath ( )

Returns the image path for web accessable images of a question.

The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 1023 of file class.assQuestion.php.

Referenced by assJavaApplet\copyApplet(), assJavaApplet\deleteJavaAppletFilename(), assJavaApplet\duplicateApplet(), and assJavaApplet\setJavaAppletFilename().

{
return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/java/";
}

+ Here is the caller graph for this function:

assQuestion::getJavaPathWeb ( )

Returns the web image path for web accessable java applets of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/java

public

Definition at line 1065 of file class.assQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/java/";
}

+ Here is the call graph for this function:

assQuestion::getMaximumPoints ( )

Returns the maximum points, a learner can reach answering the question.

public

See Also
$points

Reimplemented in assMatchingQuestion, assClozeTest, assOrderingQuestion, assImagemapQuestion, assSingleChoice, assMultipleChoice, assTextSubset, assFlashQuestion, assTextQuestion, assNumeric, assErrorText, assFileUpload, and assOrderingHorizontal.

Definition at line 769 of file class.assQuestion.php.

References $points.

Referenced by calculateReachedPoints(), and saveQuestionDataToDb().

{
return $this->points;
}

+ Here is the caller graph for this function:

assQuestion::getOriginalId ( )
assQuestion::getOutputType ( )

Gets the output type.

Returns
integer The output type of the question public
See Also
$outputType

Reimplemented in assSingleChoice, and assMultipleChoice.

Definition at line 503 of file class.assQuestion.php.

References $outputType.

Referenced by __get(), and assOrderingQuestion\checkSaveData().

{
}

+ Here is the caller graph for this function:

assQuestion::getOwner ( )

Gets the creator/owner ID of the assQuestion object.

Returns
integer The numerical ID to identify the owner/creator public
See Also
$owner

Definition at line 554 of file class.assQuestion.php.

References $owner.

Referenced by __get(), saveQuestionDataToDb(), and saveToDb().

{
return $this->owner;
}

+ Here is the caller graph for this function:

assQuestion::getPageOfQuestion ( )

Definition at line 1652 of file class.assQuestion.php.

References $page.

{
include_once "./Services/COPage/classes/class.ilPageObject.php";
$page = new ilPageObject("qpl", $this->id);
return $page->getXMLContent();
}
assQuestion::getQuestion ( )

Gets the question string of the question object.

Returns
string The question string of the question object public
See Also
$question

Definition at line 2880 of file class.assQuestion.php.

References $question.

Referenced by __get(), formatSAQuestion(), getRTETextWithMediaObjects(), saveQuestionDataToDb(), assOrderingHorizontal\toJSON(), assTextQuestion\toJSON(), assTextSubset\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
}

+ Here is the caller graph for this function:

assQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

Reimplemented in assClozeTest, assMatchingQuestion, assOrderingQuestion, assJavaApplet, assSingleChoice, assMultipleChoice, assImagemapQuestion, assFileUpload, assTextSubset, assTextQuestion, assNumeric, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 2903 of file class.assQuestion.php.

Referenced by fromXML(), getQuestionTypeID(), and toXML().

{
// must be overwritten in every parent class
return "";
}

+ Here is the caller graph for this function:

assQuestion::getQuestionTypeFromDb (   $question_id)

get question type for question id

note: please don't use $this in this class to allow static calls

Definition at line 1216 of file class.assQuestion.php.

References $data, $ilDB, and $result.

Referenced by assQuestionGUI\_getGUIClassNameForId(), assQuestionGUI\_getQuestionGUI(), and ilObjTestGUI\executeCommand().

{
global $ilDB;
$result = $ilDB->queryF("SELECT qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
array('integer'),
array($question_id)
);
$data = $ilDB->fetchAssoc($result);
return $data["type_tag"];
}

+ Here is the caller graph for this function:

assQuestion::getQuestionTypeID ( )

Returns the question type of the question.

Returns the question type of the question

Returns
integer The question type of the question public

Definition at line 2917 of file class.assQuestion.php.

References $ilDB, $result, $row, and getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
array('text'),
array($this->getQuestionType())
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["question_type_id"];
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getReachedPoints (   $active_id,
  $pass = NULL 
)

Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question public

Definition at line 758 of file class.assQuestion.php.

References $pass, _getReachedPoints(), and getId().

{
return round($this->_getReachedPoints($active_id, $this->getId(), $pass), 2);
}

+ Here is the call graph for this function:

assQuestion::getRTETextWithMediaObjects ( )

Collects all text in the question which could contain media objects which were created with the Rich Text Editor.

Reimplemented in assClozeTest, assMatchingQuestion, assSingleChoice, assMultipleChoice, assOrderingQuestion, assJavaApplet, assImagemapQuestion, assTextSubset, assFileUpload, assTextQuestion, assNumeric, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 3081 of file class.assQuestion.php.

References getFeedbackGeneric(), and getQuestion().

Referenced by cleanupMediaObjectUsage().

{
// must be called in parent classes. add additional RTE text in the parent
// classes and call this method to add the standard RTE text
$collected = $this->getQuestion();
$collected .= $this->getFeedbackGeneric(0);
$collected .= $this->getFeedbackGeneric(1);
foreach ($this->suggested_solutions as $solution_array)
{
$collected .= $solution_array["value"];
}
return $collected;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getShuffle ( )

Gets the shuffle flag.

Returns
boolean The shuffle flag public
See Also
$shuffle

Definition at line 467 of file class.assQuestion.php.

References $shuffle.

Referenced by __get(), assMultipleChoice\saveToDb(), assSingleChoice\saveToDb(), assTextQuestion\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), and assClozeTest\toJSON().

{
}

+ Here is the caller graph for this function:

& assQuestion::getSolutionValues (   $active_id,
  $pass = NULL 
)

Loads solutions of a given user from the database an returns it.

Parameters
integer$test_idThe database id of the test containing this question public
See Also
$answers

Definition at line 1124 of file class.assQuestion.php.

References $ilDB, $pass, $result, $row, getId(), and getSolutionMaxPass().

Referenced by assOrderingHorizontal\moveRight(), assErrorText\setExportDetailsXLS(), assOrderingHorizontal\setExportDetailsXLS(), assNumeric\setExportDetailsXLS(), assTextQuestion\setExportDetailsXLS(), assFileUpload\setExportDetailsXLS(), assTextSubset\setExportDetailsXLS(), assImagemapQuestion\setExportDetailsXLS(), assJavaApplet\setExportDetailsXLS(), assOrderingQuestion\setExportDetailsXLS(), assMultipleChoice\setExportDetailsXLS(), assSingleChoice\setExportDetailsXLS(), assMatchingQuestion\setExportDetailsXLS(), and assClozeTest\setExportDetailsXLS().

{
global $ilDB;
$values = array();
if (is_null($pass))
{
$pass = $this->getSolutionMaxPass($active_id);
}
$result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s ORDER BY solution_id",
array('integer','integer','integer'),
array($active_id, $this->getId(), $pass)
);
while ($row = $ilDB->fetchAssoc($result))
{
array_push($values, $row);
}
return $values;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getSuggestedSolution (   $subquestion_index = 0)

Returns a suggested solution for a given subquestion index.

Parameters
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
array A suggested solution array containing the internal link public

Definition at line 1943 of file class.assQuestion.php.

{
if (array_key_exists($subquestion_index, $this->suggested_solutions))
{
return $this->suggested_solutions[$subquestion_index];
}
else
{
return array();
}
}
assQuestion::getSuggestedSolutionOutput ( )

Definition at line 657 of file class.assQuestion.php.

References _getInternalLinkHref(), getSuggestedSolutionPathWeb(), ilUtil\prepareFormOutput(), and prepareTextareaOutput().

{
$output = array();
foreach ($this->suggested_solutions as $solution)
{
switch ($solution["type"])
{
case "lm":
case "st":
case "pg":
case "git":
array_push($output, '<a href="' . assQuestion::_getInternalLinkHref($solution["internal_link"]) . '">' . $this->lng->txt("solution_hint") . '</a>');
break;
case "file":
array_push($output, '<a href="' . $this->getSuggestedSolutionPathWeb() . $solution["value"]["name"] . '">' . ((strlen($solution["value"]["filenme"])) ? ilUtil::prepareFormOutput($solution["value"]["filenme"]) : $this->lng->txt("solution_hint")) . '</a>');
break;
case "text":
array_push($output, $this->prepareTextareaOutput($solution["value"]));
break;
}
}
return join($output, "<br />");
}

+ Here is the call graph for this function:

assQuestion::getSuggestedSolutionPath ( )

Returns the path for a suggested solution.

public

Definition at line 1013 of file class.assQuestion.php.

Referenced by copySuggestedSolutionFiles(), deleteSuggestedSolutions(), duplicateSuggestedSolutionFiles(), and syncSuggestedSolutionFiles().

{
return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
}

+ Here is the caller graph for this function:

assQuestion::getSuggestedSolutionPathWeb ( )

Returns the web path for a suggested solution.

public

Definition at line 1077 of file class.assQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/solution/";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getSuggestedSolutions ( )

Return the suggested solutions.

Returns
array Suggested solutions

Definition at line 716 of file class.assQuestion.php.

References $suggested_solutions.

Referenced by __get().

+ Here is the caller graph for this function:

assQuestion::getSuggestedSolutionTitle (   $subquestion_index = 0)

Returns the title of a suggested solution at a given subquestion_index.

This can be usable for displaying suggested solutions

Parameters
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
string A string containing the type and title of the internal link public

Definition at line 1963 of file class.assQuestion.php.

References $title.

{
if (array_key_exists($subquestion_index, $this->suggested_solutions))
{
$title = $this->suggested_solutions[$subquestion_index]["internal_link"];
// TO DO: resolve internal link an get link type and title
}
else
{
$title = "";
}
return $title;
}
assQuestion::getTestId ( )

Gets the test id of the assQuestion object.

Returns
integer The test id of the assQuestion object public
See Also
$test_id

Definition at line 479 of file class.assQuestion.php.

References $test_id.

Referenced by __get().

{
}

+ Here is the caller graph for this function:

assQuestion::getTotalAnswers ( )

get total number of answers

Definition at line 1470 of file class.assQuestion.php.

References _getTotalAnswers().

{
return $this->_getTotalAnswers($this->id);
}

+ Here is the call graph for this function:

assQuestion::isClone (   $question_id = "")

Checks whether the question is a clone of another question or not.

Returns
boolean TRUE if the question is a clone, otherwise FALSE public

Definition at line 1180 of file class.assQuestion.php.

References $id, $ilDB, $result, and $row.

{
global $ilDB;
if ($question_id < 1) $question_id = $this->id;
$result = $ilDB->queryF("SELECT original_id FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_id)
);
$row = $ilDB->fetchAssoc($result);
return ($row["original_id"] > 0) ? TRUE : FALSE;
}
assQuestion::isComplete ( )

Returns true, if a question is complete for use.

Returns
boolean True, if the question is complete for use, otherwise false public

Reimplemented in assJavaApplet, assClozeTest, assMatchingQuestion, assOrderingQuestion, assImagemapQuestion, assTextQuestion, assMultipleChoice, assSingleChoice, assTextSubset, assNumeric, assFileUpload, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 269 of file class.assQuestion.php.

Referenced by saveToDb().

{
return false;
}

+ Here is the caller graph for this function:

assQuestion::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean public

Definition at line 2694 of file class.assQuestion.php.

Referenced by addQTIMaterial(), and assTextQuestion\saveWorkingData().

{
if (preg_match("/<[^>]*?>/", $a_text))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the caller graph for this function:

assQuestion::isInUse (   $question_id = "")

Checks whether the question is in use or not.

Returns
boolean The number of datasets which are affected by the use of the query. public

Definition at line 1153 of file class.assQuestion.php.

References $ilDB, $result, $row, and getId().

{
global $ilDB;
if ($question_id < 1) $question_id = $this->getId();
$result = $ilDB->queryF("SELECT COUNT(qpl_questions.question_id) question_count FROM qpl_questions, tst_test_question WHERE qpl_questions.original_id = %s AND qpl_questions.question_id = tst_test_question.question_fi",
array('integer'),
array($question_id)
);
$row = $ilDB->fetchAssoc($result);
$count = $row["question_count"];
$result = $ilDB->queryF("SELECT DISTINCT tst_active.test_fi, qpl_questions.question_id FROM qpl_questions, tst_test_rnd_qst, tst_active WHERE qpl_questions.original_id = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.active_fi = tst_active.active_id",
array('integer'),
array($question_id)
);
$count += $result->numRows();
return $count;
}

+ Here is the call graph for this function:

assQuestion::keyInArray (   $searchkey,
  $array 
)

returns TRUE if the key occurs in an array

Parameters
string$arraykeyA key to an element in array
array$arrayAn array to be searched public

Definition at line 393 of file class.assQuestion.php.

{
if ($searchKey)
{
foreach ($array as $key => $value)
{
if (strcmp($key, $searchkey)==0)
{
return true;
}
}
}
return false;
}
assQuestion::loadFromDb (   $question_id)

Loads the question from the database.

Parameters
integer$question_idA unique key which defines the question in the database public

Reimplemented in assImagemapQuestion, assJavaApplet, assSingleChoice, assMultipleChoice, assMatchingQuestion, assOrderingQuestion, assTextSubset, assClozeTest, assTextQuestion, assNumeric, assErrorText, assFlashQuestion, assFileUpload, and assOrderingHorizontal.

Definition at line 1730 of file class.assQuestion.php.

References $ilDB, $result, $row, ilRTE\_replaceMediaObjectImageSrc(), and getId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
$this->suggested_solutions = array();
if ($result->numRows())
{
include_once("./Services/RTE/classes/class.ilRTE.php");
while ($row = $ilDB->fetchAssoc($result))
{
$value = (is_array(unserialize($row["value"]))) ? unserialize($row["value"]) : ilRTE::_replaceMediaObjectImageSrc($row["value"], 1);
$this->suggested_solutions[$row["subquestion_index"]] = array(
"type" => $row["type"],
"value" => $value,
"internal_link" => $row["internal_link"],
"import_id" => $row["import_id"]
);
}
}
}

+ Here is the call graph for this function:

assQuestion::logAction (   $logtext = "",
  $active_id = "",
  $question_id = "" 
)

Logs an action into the Test&Assessment log.

Parameters
string$logtextThe log text
integer$question_idIf given, saves the question id to the database public

Definition at line 947 of file class.assQuestion.php.

References $original_id, ilObjAssessmentFolder\_addLog(), ilObjTest\_getObjectIDFromActiveID(), and _getOriginalId().

Referenced by calculateResultsFromSolution(), assOrderingHorizontal\moveRight(), assOrderingHorizontal\saveWorkingData(), assErrorText\saveWorkingData(), assNumeric\saveWorkingData(), assTextQuestion\saveWorkingData(), assFileUpload\saveWorkingData(), assTextSubset\saveWorkingData(), assSingleChoice\saveWorkingData(), assMultipleChoice\saveWorkingData(), assImagemapQuestion\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), assClozeTest\saveWorkingData(), and assErrorText\toggleSelection().

{
global $ilUser;
if (strcmp($question_id, "") != 0)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
}
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
ilObjAssessmentFolder::_addLog($ilUser->id, ilObjTest::_getObjectIDFromActiveID($active_id), $logtext, $question_id, $original_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::lookupOriginalParentObjId (   $originalQuestionId)
static

returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too)

ilDB $ilDB

Parameters
integer$originalQuestionId
Returns
integer $originalQuestionParentObjectId

Definition at line 2382 of file class.assQuestion.php.

References $ilDB, $query, $res, and $row.

Referenced by syncWithOriginal().

{
global $ilDB;
$query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
$res = $ilDB->queryF($query, array('integer'), array((int)$originalQuestionId));
$row = $ilDB->fetchAssoc($res);
return $row['obj_fi'];
}

+ Here is the caller graph for this function:

assQuestion::moveUploadedMediaFile (   $file,
  $name 
)

Move an uploaded media file to an public accessible temp dir to present it.

Parameters
string$fileFile path
string$nameName of the file public

Definition at line 991 of file class.assQuestion.php.

References $file, ilUtil\createDirectory(), and ilUtil\moveUploadedFile().

{
$mediatempdir = CLIENT_WEB_DIR . "/assessment/temp";
if (!@is_dir($mediatempdir)) ilUtil::createDirectory($mediatempdir);
$temp_name = tempnam($mediatempdir, $name . "_____");
$temp_name = str_replace("\\", "/", $temp_name);
@unlink($temp_name);
if (!ilUtil::moveUploadedFile($file, $name, $temp_name))
{
return FALSE;
}
else
{
return $temp_name;
}
}

+ Here is the call graph for this function:

assQuestion::onCopy (   $source_questionpool_id,
  $source_question_id 
)
protected

Will be called when a question is copied (into another question pool)

Definition at line 1913 of file class.assQuestion.php.

References copySuggestedSolutionFiles().

{
$this->copySuggestedSolutionFiles($source_questionpool_id, $source_question_id);
}

+ Here is the call graph for this function:

assQuestion::onDuplicate (   $originalParentId,
  $originalQuestionId,
  $duplicateParentId,
  $duplicateQuestionId 
)
protected

Will be called when a question is duplicated (inside a question pool or for insertion in a test)

Definition at line 1905 of file class.assQuestion.php.

References duplicateSuggestedSolutionFiles().

{
$this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
}

+ Here is the call graph for this function:

assQuestion::pcArrayShuffle (   $array)

Shuffles the values of a given array.

Parameters
array$arrayAn array which should be shuffled public

Definition at line 1199 of file class.assQuestion.php.

References $result.

Referenced by assOrderingQuestion\toJSON(), and assMatchingQuestion\toJSON().

{
$keys = array_keys($array);
shuffle($keys);
$result = array();
foreach ($keys as $key)
{
$result[$key] = $array[$key];
}
return $result;
}

+ Here is the caller graph for this function:

assQuestion::prepareTextareaOutput (   $txt_output,
  $prepare_for_latex_output = FALSE 
)

Prepares a string for a text area output in tests.

Parameters
string$txt_outputString which should be prepared for output public

Definition at line 2712 of file class.assQuestion.php.

Referenced by getSuggestedSolutionOutput(), and assClozeTest\updateClozeTextFromGaps().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
}

+ Here is the caller graph for this function:

assQuestion::QTIMaterialToString (   $a_material)

Reads an QTI material tag an creates a text string.

Parameters
string$a_materialQTI material tag
Returns
string text or xhtml string public

Definition at line 2725 of file class.assQuestion.php.

References $_SESSION, and $result.

{
$result = "";
for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
{
$material = $a_material->getMaterial($i);
if (strcmp($material["type"], "mattext") == 0)
{
$result .= $material["material"]->getContent();
}
if (strcmp($material["type"], "matimage") == 0)
{
$matimage = $material["material"];
if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
{
// import an mediaobject which was inserted using tiny mce
if (!is_array($_SESSION["import_mob_xhtml"])) $_SESSION["import_mob_xhtml"] = array();
array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
}
}
}
return $result;
}
assQuestion::questionTitleExists (   $questionpool_id,
  $title 
)

Returns TRUE if the question title exists in the database.

Parameters
string$titleThe title of the question
Returns
boolean The result of the title check public

Definition at line 281 of file class.assQuestion.php.

References $ilDB, $result, and $title.

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM qpl_questions WHERE obj_fi = %s AND title = %s",
array('integer','text'),
array($questionpool_id, $title)
);
return ($result->numRows() == 1) ? TRUE : FALSE;
}
assQuestion::saveQuestionDataToDb (   $original_id = "")

Definition at line 1810 of file class.assQuestion.php.

References $ilDB, $original_id, ilRTE\_replaceMediaObjectImageSrc(), createPageObject(), getAuthor(), getComment(), getEstimatedWorkingTime(), getId(), getMaximumPoints(), getNrOfTries(), getObjId(), getOwner(), getQuestion(), getQuestionTypeID(), getTitle(), and setId().

Referenced by assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assFileUpload\saveToDb(), assNumeric\saveToDb(), assTextSubset\saveToDb(), assMultipleChoice\saveToDb(), assTextQuestion\saveToDb(), assSingleChoice\saveToDb(), assOrderingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assClozeTest\saveToDb(), and assJavaApplet\saveToDb().

{
global $ilDB;
$estw_time = $this->getEstimatedWorkingTime();
$estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
// cleanup RTE images which are not inserted into the question text
include_once("./Services/RTE/classes/class.ilRTE.php");
if ($this->getId() == -1)
{
// Neuen Datensatz schreiben
$next_id = $ilDB->nextId('qpl_questions');
$affectedRows = $ilDB->insert("qpl_questions", array(
"question_id" => array("integer", $next_id),
"question_type_fi" => array("integer", $this->getQuestionTypeID()),
"obj_fi" => array("integer", $this->getObjId()),
"title" => array("text", $this->getTitle()),
"description" => array("text", $this->getComment()),
"author" => array("text", $this->getAuthor()),
"owner" => array("integer", $this->getOwner()),
"question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
"points" => array("float", $this->getMaximumPoints()),
"working_time" => array("text", $estw_time),
"nr_of_tries" => array("integer", (strlen($this->getNrOfTries())) ? $this->getNrOfTries() : 1),
"created" => array("integer", time()),
"original_id" => array("integer", ($original_id) ? $original_id : NULL),
"tstamp" => array("integer", time())
));
$this->setId($next_id);
// create page object of question
$this->createPageObject();
}
else
{
// Vorhandenen Datensatz aktualisieren
$affectedRows = $ilDB->update("qpl_questions", array(
"obj_fi" => array("integer", $this->getObjId()),
"title" => array("text", $this->getTitle()),
"description" => array("text", $this->getComment()),
"author" => array("text", $this->getAuthor()),
"question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
"points" => array("float", $this->getMaximumPoints()),
"nr_of_tries" => array("integer", (strlen($this->getNrOfTries())) ? $this->getNrOfTries() : 1),
"working_time" => array("text", $estw_time),
"tstamp" => array("integer", time())
), array(
"question_id" => array("integer", $this->getId())
));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::saveToDb (   $original_id = "")

Saves the question to the database.

Parameters
integer$original_idpublic

Reimplemented in assJavaApplet, assClozeTest, assMatchingQuestion, assImagemapQuestion, assOrderingQuestion, assSingleChoice, assTextQuestion, assMultipleChoice, assTextSubset, assNumeric, assFileUpload, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 1868 of file class.assQuestion.php.

References $ilDB, ilObjQuestionPool\_updateQuestionCount(), cleanupMediaObjectUsage(), getId(), getOwner(), and isComplete().

Referenced by syncWithOriginal().

{
global $ilDB;
$this->updateSuggestedSolutions();
// remove unused media objects from ILIAS
$complete = "0";
if ($this->isComplete())
{
$complete = "1";
}
// update the question time stamp and completion status
$affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s",
array('integer','integer', 'integer','text'),
array(time(), ($this->getOwner() <= 0) ? $this->ilias->account->id : $this->getOwner(), $complete, $this->getId())
);
// update question count of question pool
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::saveWorkingData (   $active_id,
  $pass = NULL 
)

Saves the learners input of the question to the database.

Parameters
integer$active_idActive id of the user
integer$passTest pass

Reimplemented in assClozeTest, assMatchingQuestion, assJavaApplet, assOrderingQuestion, assImagemapQuestion, assMultipleChoice, assSingleChoice, assTextSubset, assFileUpload, assTextQuestion, assFlashQuestion, assNumeric, assErrorText, and assOrderingHorizontal.

Definition at line 834 of file class.assQuestion.php.

References $pass, and calculateResultsFromSolution().

{
$this->calculateResultsFromSolution($active_id, $pass);
}

+ Here is the call graph for this function:

assQuestion::setAuthor (   $author = "")

Sets the authors name of the assQuestion object.

Parameters
string$authorA string containing the name of the questions author public
See Also
$author

Definition at line 415 of file class.assQuestion.php.

References $author.

Referenced by __set(), assOrderingHorizontal\loadFromDb(), assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), assErrorText\loadFromDb(), assNumeric\loadFromDb(), assTextQuestion\loadFromDb(), assClozeTest\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assSingleChoice\loadFromDb(), assJavaApplet\loadFromDb(), and assImagemapQuestion\loadFromDb().

{
if (!$author)
{
$author = $this->ilias->account->fullname;
}
$this->author = $author;
}

+ Here is the caller graph for this function:

assQuestion::setComment (   $comment = "")
assQuestion::setEstimatedWorkingTime (   $hour = 0,
  $min = 0,
  $sec = 0 
)

Sets the estimated working time of a question.

Parameters
integer$hourHour
integer$minMinutes
integer$secSeconds public
See Also
$comment

Definition at line 381 of file class.assQuestion.php.

Referenced by __construct(), __set(), assOrderingHorizontal\loadFromDb(), assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), assErrorText\loadFromDb(), assNumeric\loadFromDb(), assTextQuestion\loadFromDb(), assClozeTest\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assSingleChoice\loadFromDb(), assJavaApplet\loadFromDb(), and assImagemapQuestion\loadFromDb().

{
$this->est_working_time = array("h" => (int)$hour, "m" => (int)$min, "s" => (int)$sec);
}

+ Here is the caller graph for this function:

assQuestion::setExportDetailsXLS ( $worksheet,
  $startrow,
  $active_id,
  $pass,
$format_title,
$format_bold 
)

Creates an Excel worksheet for the detailed cumulated results of this question.

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data public

Reimplemented in assClozeTest, assMatchingQuestion, assSingleChoice, assMultipleChoice, assOrderingQuestion, assJavaApplet, assImagemapQuestion, assTextSubset, assFileUpload, assTextQuestion, assNumeric, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 3285 of file class.assQuestion.php.

{
return $startrow;
}
assQuestion::setExportImagePath (   $a_path)

Definition at line 3429 of file class.assQuestion.php.

{
$this->export_image_path = (string)$a_path;
}
assQuestion::setNewOriginalId (   $newId)

Definition at line 1894 of file class.assQuestion.php.

References $ilDB, and getId().

{
global $ilDB;
$ilDB->manipulateF("UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s",
array('integer','integer', 'text'),
array(time(), $newId, $this->getId())
);
}

+ Here is the call graph for this function:

assQuestion::setObjId (   $obj_id = 0)
assQuestion::setOutputType (   $outputType = OUTPUT_HTML)

Sets the output type.

Parameters
integer$outputTypeThe output type of the question public
See Also
$outputType

Reimplemented in assSingleChoice, and assMultipleChoice.

Definition at line 347 of file class.assQuestion.php.

References $outputType.

Referenced by __set().

{
$this->outputType = $outputType;
}

+ Here is the caller graph for this function:

assQuestion::setOwner (   $owner = "")
assQuestion::setPoints (   $a_points)
assQuestion::setQuestion (   $question = "")
assQuestion::setShuffle (   $shuffle = true)

Sets the shuffle flag.

Parameters
boolean$shuffleA flag indicating whether the answers are shuffled or not public
See Also
$shuffle

Reimplemented in assMatchingQuestion.

Definition at line 360 of file class.assQuestion.php.

References $shuffle.

Referenced by __set(), assTextQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), and assSingleChoice\loadFromDb().

{
if ($shuffle)
{
$this->shuffle = 1;
}
else
{
$this->shuffle = 0;
}
}

+ Here is the caller graph for this function:

assQuestion::setSuggestedSolution (   $solution_id = "",
  $subquestion_index = 0,
  $is_import = false 
)

Sets a suggested solution for the question.

If there is more than one subquestion (i.e. close questions) may enter a subquestion index.

Parameters
string$solution_idAn internal link pointing to the suggested solution
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
boolean$is_importA boolean indication that the internal link was imported from another ILIAS installation public

Definition at line 1986 of file class.assQuestion.php.

References _resolveInternalLink().

Referenced by assFileUpload\loadFromDb(), and assFlashQuestion\loadFromDb().

{
if (strcmp($solution_id, "") != 0)
{
$import_id = "";
if ($is_import)
{
$import_id = $solution_id;
$solution_id = $this->_resolveInternalLink($import_id);
}
$this->suggested_solutions[$subquestion_index] = array(
"internal_link" => $solution_id,
"import_id" => $import_id
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::setTestId (   $id = -1)

Sets the test id of the assQuestion object.

Parameters
integer$idA unique integer value public
See Also
$test_id

Definition at line 323 of file class.assQuestion.php.

References $id.

Referenced by __set().

{
$this->test_id = $id;
}

+ Here is the caller graph for this function:

assQuestion::setTitle (   $title = "")
assQuestion::supportsJavascriptOutput ( )

Returns true if the question type supports JavaScript output.

Returns
boolean TRUE if the question type supports JavaScript output, FALSE otherwise public

Reimplemented in assMatchingQuestion, and assOrderingQuestion.

Definition at line 514 of file class.assQuestion.php.

{
return FALSE;
}
assQuestion::syncSuggestedSolutionFiles (   $original_id)
protected

Syncs the files of a suggested solution if the question is synced.

Definition at line 2040 of file class.assQuestion.php.

References $filename, $ilLog, ilUtil\delDir(), getSuggestedSolutionPath(), and ilUtil\makeDirParents().

{
global $ilLog;
$filepath = $this->getSuggestedSolutionPath();
$filepath_original = str_replace("/$this->id/solution", "/$original_id/solution", $filepath);
ilUtil::delDir($filepath_original);
foreach ($this->suggested_solutions as $index => $solution)
{
if (strcmp($solution["type"], "file") == 0)
{
if (!file_exists($filepath_original))
{
ilUtil::makeDirParents($filepath_original);
}
$filename = $solution["value"]["name"];
if (strlen($filename))
{
if (!@copy($filepath . $filename, $filepath_original . $filename))
{
$ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
$ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
}
}
}
}
}

+ Here is the call graph for this function:

assQuestion::syncWithOriginal ( )

Reimplemented in assSingleChoice, assMultipleChoice, and assImagemapQuestion.

Definition at line 2340 of file class.assQuestion.php.

References $id, $ilDB, copyPageOfQuestion(), createPageObject(), deletePageOfQuestion(), getId(), getOriginalId(), lookupOriginalParentObjId(), saveToDb(), setId(), setObjId(), setOriginalId(), and syncXHTMLMediaObjectsOfQuestion().

{
global $ilDB;
if( !$this->getOriginalId() )
{
return;
}
$originalObjId = self::lookupOriginalParentObjId($this->getOriginalId());
if ( !$originalObjId )
{
return;
}
$id = $this->getId();
$original = $this->getOriginalId();
$this->setId($this->getOriginalId());
$this->setOriginalId(NULL);
$this->setObjId($originalObjId);
$this->saveToDb();
$this->deletePageOfQuestion($original);
$this->createPageObject();
$this->setId($id);
$this->setOriginalId($original);
$this->updateSuggestedSolutions($original);
$this->syncFeedbackGeneric();
}

+ Here is the call graph for this function:

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

Definition at line 1611 of file class.assQuestion.php.

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_saveUsage(), and getId().

Referenced by syncWithOriginal().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
foreach ($mobs as $mob)
{
ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->original_id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::toXML (   $a_include_header = true,
  $a_include_binary = true,
  $a_shuffle = false,
  $test_output = false,
  $force_image_references = false 
)

Returns a QTI xml representation of the question.

Returns
string The QTI xml representation of the question public

Reimplemented in assFileUpload, assFlashQuestion, assOrderingHorizontal, and assErrorText.

Definition at line 255 of file class.assQuestion.php.

References getQuestionType().

{
include_once "./Modules/TestQuestionPool/classes/export/qti12/class." . $this->getQuestionType() . "Export.php";
$classname = $this->getQuestionType() . "Export";
$export = new $classname($this);
return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
}

+ Here is the call graph for this function:

Field Documentation

assQuestion::$arrData
private

Associative array to store properties.

Definition at line 172 of file class.assQuestion.php.

assQuestion::$est_working_time
protected

Definition at line 92 of file class.assQuestion.php.

Referenced by getEstimatedWorkingTime().

assQuestion::$export_image_path
private

(Web) Path to images

Definition at line 177 of file class.assQuestion.php.

Referenced by getImagePathWeb().

assQuestion::$ilias
protected

Definition at line 120 of file class.assQuestion.php.

Referenced by __construct(), and __get().

assQuestion::$lng
protected

Definition at line 134 of file class.assQuestion.php.

Referenced by __construct(), _getQuestionTypeName(), and _setReachedPoints().

assQuestion::$nr_of_tries
private

Number of tries.

Definition at line 167 of file class.assQuestion.php.

Referenced by getNrOfTries().

assQuestion::$obj_id
protected

Definition at line 113 of file class.assQuestion.php.

Referenced by createNewQuestion(), delete(), getImagePath(), getObjId(), and setObjId().

assQuestion::$outputType
protected

Definition at line 141 of file class.assQuestion.php.

Referenced by getOutputType(), and setOutputType().

assQuestion::$page
protected
assQuestion::$points
protected

Definition at line 85 of file class.assQuestion.php.

Referenced by _getMaximumPoints(), _getReachedPoints(), _isWorkedThrough(), _setReachedPoints(), assTextSubset\addAnswer(), assMultipleChoice\addAnswer(), assSingleChoice\addAnswer(), assImagemapQuestion\addAnswer(), assErrorText\addErrorData(), assMatchingQuestion\addMatchingPair(), assOrderingHorizontal\calculateReachedPoints(), assFileUpload\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assFlashQuestion\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assImagemapQuestion\calculateReachedPoints(), assOrderingQuestion\calculateReachedPoints(), assJavaApplet\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assClozeTest\calculateReachedPoints(), calculateReachedPoints(), assErrorText\getBestSelection(), assClozeTest\getMaximumGapPoints(), assTextQuestion\getMaximumPoints(), assFlashQuestion\getMaximumPoints(), assTextSubset\getMaximumPoints(), assMultipleChoice\getMaximumPoints(), assSingleChoice\getMaximumPoints(), assImagemapQuestion\getMaximumPoints(), assClozeTest\getMaximumPoints(), getMaximumPoints(), assMatchingQuestion\getMaximumPoints(), getPoints(), assErrorText\getPointsForSelectedPositions(), assFileUpload\handleSubmission(), assMatchingQuestion\insertMatchingPair(), assErrorText\setErrorData(), assClozeTest\setGapAnswerPoints(), and assTextQuestion\setReachedPoints().

assQuestion::$suggested_solutions
protected

Definition at line 148 of file class.assQuestion.php.

Referenced by getSuggestedSolutions().

assQuestion::$tpl
protected

Definition at line 127 of file class.assQuestion.php.

Referenced by __construct(), and __get().


The documentation for this class was generated from the following file: