ILIAS  Release_4_0_x_branch Revision 61816
 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 ()
 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 ()
 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.
 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.
 updateSuggestedSolutions ($original_id="")
 Update the suggested solutions of a question based on the suggested solution array attribute.
 saveSuggestedSolution ($type, $solution_id="", $subquestion_index=0, $value="")
 Saves 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.
_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.
 saveFeedbackGeneric ($correctness, $feedback)
 Saves generic feedback to the database.
 getFeedbackGeneric ($correctness)
 Returns the generic feedback for a given question state.
 duplicateFeedbackGeneric ($original_id)
 Duplicates the generic feedback of a question.
 syncFeedbackGeneric ()
 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)

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 _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 ($source_question_id)
 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 ($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.

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 26049 2010-10-18 06:39:32Z hschottm

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, assTextSubset, assTextQuestion, assNumeric, assFlashQuestion, assErrorText, assOrderingHorizontal, and assFileUpload.

Definition at line 184 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 assErrorText, assFileUpload, and assOrderingHorizontal.

Definition at line 3165 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 assErrorText, assFileUpload, and assOrderingHorizontal.

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

References $key, 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 2564 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 2223 of file class.assQuestion.php.

References $ilDB, $target_id, and $type.

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 584 of file class.assQuestion.php.

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

Referenced by _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), 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 2266 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by _logAction(), ilObjTest\cloneObject(), assFileUpload\copyObject(), assOrderingHorizontal\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assFlashQuestion\copyObject(), assErrorText\copyObject(), assNumeric\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assJavaApplet\copyObject(), assClozeTest\copyObject(), assFileUpload\duplicate(), assOrderingHorizontal\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assTextQuestion\duplicate(), assErrorText\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 607 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 1560 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by ilObjectivesAlignmentTableGUI\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 1671 of file class.assQuestion.php.

References $data, $ilDB, and $result.

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

{
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 1644 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 3102 of file class.assQuestion.php.

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

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

{
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 723 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 2416 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 684 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 628 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 645 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 1537 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 1459 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 1490 of file class.assQuestion.php.

References $ilDB, $key, $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 3073 of file class.assQuestion.php.

References $type, 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 2356 of file class.assQuestion.php.

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

Referenced by _getSuggestedSolutionOutput(), ilSCORM2004Sco\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 3132 of file class.assQuestion.php.

References _getQuestionType(), and _includeClass().

Referenced by ilObjQuestionPool\createQuestion(), ilQuestionPoolPrintViewTableGUI\fillRow(), and ilObjQuestionPoolGUI\printObject().

{
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 2482 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 2533 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 2450 of file class.assQuestion.php.

References $ilDB, $result, and $row.

Referenced by assQuestionGUI\save(), assQuestionGUI\saveEdit(), assQuestionGUI\saveFeedback(), 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 964 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 3026 of file class.assQuestion.php.

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

Referenced by 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 2326 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::_resolveInternalLink (   $internal_link)

Definition at line 2135 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 2172 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 2706 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 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 881 of file class.assQuestion.php.

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

Referenced by ilObjTestAccess\_isPassed(), _setReachedPoints(), calculateResultsFromSolution(), 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 834 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 2648 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 2503 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 775 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 2971 of file class.assQuestion.php.

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

Referenced by saveSuggestedSolution(), saveToDb(), and updateSuggestedSolutions().

{
$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 1616 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 2020 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 1579 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 2685 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 ( )

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 1739 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)
{
$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", 0)
));
$this->setId($next_id);
// 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 1602 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 2315 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 1318 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 1269 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, assErrorText, and assOrderingHorizontal.

Definition at line 1234 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 1304 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 1877 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::duplicateFeedbackGeneric (   $original_id)

Duplicates the generic feedback of a question.

Parameters
integer$original_idThe database ID of the original question public

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

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

{
global $ilDB;
$feedback = "";
$result = $ilDB->queryF("SELECT * FROM qpl_fb_generic WHERE question_fi = %s",
array('integer'),
array($original_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$next_id = $ilDB->nextId('qpl_fb_generic');
$affectedRows = $ilDB->manipulateF("INSERT INTO qpl_fb_generic (feedback_id, question_fi, correctness, feedback, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','integer','text','text','integer'),
array($next_id, $this->getId(), $row["correctness"], $row["feedback"], time())
);
}
}
}

+ Here is the call graph for this function:

assQuestion::duplicateSuggestedSolutionFiles (   $question_id)
protected

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

Definition at line 1962 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->id/solution", "/$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::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, assErrorText, and assOrderingHorizontal.

Definition at line 236 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 3048 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, assTextSubset, assImagemapQuestion, assTextQuestion, assFileUpload, assNumeric, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 1212 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, assTextSubset, assImagemapQuestion, assFileUpload, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 1223 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 537 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 486 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 521 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 2871 of file class.assQuestion.php.

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

Referenced by getRTETextWithMediaObjects(), 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 1039 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 1088 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 450 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(), assFileUpload\copyObject(), assOrderingHorizontal\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assErrorText\copyObject(), assFlashQuestion\copyObject(), assNumeric\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assJavaApplet\copyObject(), assClozeTest\copyObject(), copyXHTMLMediaObjectsOfQuestion(), createNewQuestion(), createPageObject(), deleteSuggestedSolutions(), assFileUpload\duplicate(), assOrderingHorizontal\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assTextQuestion\duplicate(), assErrorText\duplicate(), assNumeric\duplicate(), assOrderingQuestion\duplicate(), assTextSubset\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assSingleChoice\duplicate(), assJavaApplet\duplicate(), assClozeTest\duplicate(), assImagemapQuestion\duplicateFeedbackAnswer(), assMultipleChoice\duplicateFeedbackAnswer(), assSingleChoice\duplicateFeedbackAnswer(), duplicateFeedbackGeneric(), getFeedbackGeneric(), assImagemapQuestion\getFeedbackSingleAnswer(), assMultipleChoice\getFeedbackSingleAnswer(), assSingleChoice\getFeedbackSingleAnswer(), assFileUpload\getFileUploadPath(), assFileUpload\getFileUploadPathWeb(), assFileUpload\getFileUploadZIPFile(), getInstances(), assJavaApplet\getReachedInformation(), getReachedPoints(), getSolutionMaxPass(), getSolutionValues(), assFileUpload\getUploadedFiles(), assFileUpload\hasFileUploads(), isInUse(), loadFromDb(), assOrderingHorizontal\moveRight(), saveFeedbackGeneric(), assImagemapQuestion\saveFeedbackSingleAnswer(), assMultipleChoice\saveFeedbackSingleAnswer(), assSingleChoice\saveFeedbackSingleAnswer(), saveQuestionDataToDb(), saveSuggestedSolution(), assFileUpload\saveToDb(), assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assNumeric\saveToDb(), assTextQuestion\saveToDb(), assTextSubset\saveToDb(), assMultipleChoice\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(), assTextQuestion\setReachedPoints(), syncFeedbackGeneric(), assMultipleChoice\syncFeedbackSingleAnswers(), assSingleChoice\syncFeedbackSingleAnswers(), assImagemapQuestion\syncFeedbackSingleAnswers(), syncWithOriginal(), syncXHTMLMediaObjectsOfQuestion(), assErrorText\toggleSelection(), assTextQuestion\toJSON(), assImagemapQuestion\toJSON(), assOrderingQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assMatchingQuestion\toJSON(), assClozeTest\toJSON(), and updateSuggestedSolutions().

{
return $this->id;
}

+ Here is the caller graph for this function:

assQuestion::getImagePath ( )

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 1028 of file class.assQuestion.php.

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().

{
return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->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 1075 of file class.assQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

Referenced by assImagemapQuestion\toJSON().

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

+ 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 2983 of file class.assQuestion.php.

References $ilDB, $key, $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 1018 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 1050 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, assMultipleChoice, assSingleChoice, assTextSubset, assFlashQuestion, assNumeric, assTextQuestion, assErrorText, assOrderingHorizontal, and assFileUpload.

Definition at line 764 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 assMultipleChoice, and assSingleChoice.

Definition at line 498 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 549 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 1630 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::getPoints ( )

Returns the maximum available points for the question.

Returns
integer The points public

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

References $points.

Referenced by __get(), assOrderingHorizontal\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assOrderingQuestion\calculateReachedPoints(), assFileUpload\getMaximumPoints(), assOrderingHorizontal\getMaximumPoints(), assNumeric\getMaximumPoints(), assOrderingQuestion\getMaximumPoints(), assJavaApplet\isComplete(), assNumeric\saveToDb(), assTextQuestion\setReachedPoints(), and assOrderingQuestion\toJSON().

{
if (strcmp($this->points, "") == 0)
{
return 0;
}
else
{
return $this->points;
}
}

+ Here is the caller graph for this function:

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 2771 of file class.assQuestion.php.

References $question.

Referenced by __get(), getRTETextWithMediaObjects(), saveQuestionDataToDb(), assTextQuestion\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, assTextSubset, assFileUpload, assTextQuestion, assNumeric, assFlashQuestion, assErrorText, and assOrderingHorizontal.

Definition at line 2794 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 1194 of file class.assQuestion.php.

References $data, $ilDB, and $result.

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

{
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 2808 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 753 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, assErrorText, and assOrderingHorizontal.

Definition at line 2953 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 462 of file class.assQuestion.php.

References $shuffle.

Referenced by __get(), assMultipleChoice\saveToDb(), assSingleChoice\saveToDb(), assTextQuestion\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 1102 of file class.assQuestion.php.

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

Referenced by assOrderingHorizontal\moveRight(), assOrderingHorizontal\setExportDetailsXLS(), assErrorText\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 1899 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 652 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 1008 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 1062 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 711 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 1919 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 474 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 1448 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 1158 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, assMultipleChoice, assSingleChoice, assTextSubset, assTextQuestion, assNumeric, assFlashQuestion, assErrorText, assOrderingHorizontal, and assFileUpload.

Definition at line 264 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 2585 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 1131 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 388 of file class.assQuestion.php.

References $key.

{
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 assJavaApplet, assImagemapQuestion, assSingleChoice, assMultipleChoice, assMatchingQuestion, assOrderingQuestion, assTextSubset, assClozeTest, assTextQuestion, assNumeric, assErrorText, assFlashQuestion, assOrderingHorizontal, and assFileUpload.

Definition at line 1708 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 942 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:

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 986 of file class.assQuestion.php.

References $file, $name, 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 1869 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 (   $source_question_id)
protected

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

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

References duplicateSuggestedSolutionFiles().

{
$this->duplicateSuggestedSolutionFiles($source_question_id);
}

+ 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 1177 of file class.assQuestion.php.

References $key, and $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 2603 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 2616 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 276 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::saveFeedbackGeneric (   $correctness,
  $feedback 
)

Saves generic feedback to the database.

Generic feedback is either feedback for 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
string$feedbackFeedback text public

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

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

{
global $ilDB;
switch ($correctness)
{
case 0:
$correctness = 0;
break;
case 1:
default:
$correctness = 1;
break;
}
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_fb_generic WHERE question_fi = %s AND correctness = %s",
array('integer', 'text'),
array($this->getId(), $correctness)
);
if (strlen($feedback))
{
include_once("./Services/RTE/classes/class.ilRTE.php");
$next_id = $ilDB->nextId('qpl_fb_generic');
$affectedRows = $ilDB->manipulateF("INSERT INTO qpl_fb_generic (feedback_id, question_fi, correctness, feedback, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','integer','text','text','integer'),
array($next_id, $this->getId(), $correctness, ilRTE::_replaceMediaObjectImageSrc($feedback, 0), time())
);
}
}

+ Here is the call graph for this function:

assQuestion::saveQuestionDataToDb (   $original_id = "")

Definition at line 1774 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 assFileUpload\saveToDb(), assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assNumeric\saveToDb(), assTextQuestion\saveToDb(), assTextSubset\saveToDb(), assMultipleChoice\saveToDb(), assOrderingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assSingleChoice\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::saveSuggestedSolution (   $type,
  $solution_id = "",
  $subquestion_index = 0,
  $value = "" 
)

Saves 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 2096 of file class.assQuestion.php.

References $ilDB, $type, ilRTE\_replaceMediaObjectImageSrc(), cleanupMediaObjectUsage(), and getId().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
array("integer", "integer"),
array(
$this->getId(),
$subquestion_index
)
);
$next_id = $ilDB->nextId('qpl_sol_sug');
include_once("./Services/RTE/classes/class.ilRTE.php");
$affectedRows = $ilDB->manipulateF("INSERT INTO qpl_sol_sug (suggested_solution_id, question_fi, type, value, internal_link, import_id, subquestion_index, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
array("integer","integer", "text", "text", "text", "text", "integer","integer"),
array(
$next_id,
$this->getId(),
ilRTE::_replaceMediaObjectImageSrc((is_array($value)) ? serialize($value) : $value, 0),
$solution_id,
NULL,
$subquestion_index,
time()
)
);
if ($affectedRows == 1)
{
$this->suggested_solutions["subquestion_index"] = array(
"type" => $type,
"value" => $value,
"internal_link" => $solution_id,
"import_id" => ""
);
}
}

+ Here is the call 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, assMultipleChoice, assTextSubset, assTextQuestion, assNumeric, assFlashQuestion, assErrorText, assOrderingHorizontal, and assFileUpload.

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

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

Referenced by syncWithOriginal().

{
global $ilDB;
// 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 829 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 410 of file class.assQuestion.php.

References $author.

Referenced by __set(), assFileUpload\loadFromDb(), assOrderingHorizontal\loadFromDb(), assFlashQuestion\loadFromDb(), assErrorText\loadFromDb(), assNumeric\loadFromDb(), assTextQuestion\loadFromDb(), assClozeTest\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assSingleChoice\loadFromDb(), assImagemapQuestion\loadFromDb(), and assJavaApplet\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 376 of file class.assQuestion.php.

Referenced by __construct(), __set(), assFileUpload\loadFromDb(), assOrderingHorizontal\loadFromDb(), assFlashQuestion\loadFromDb(), assErrorText\loadFromDb(), assNumeric\loadFromDb(), assTextQuestion\loadFromDb(), assClozeTest\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assSingleChoice\loadFromDb(), assImagemapQuestion\loadFromDb(), and assJavaApplet\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, assErrorText, and assOrderingHorizontal.

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

{
return $startrow;
}
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 assMultipleChoice, and assSingleChoice.

Definition at line 342 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 355 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 1942 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 318 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 509 of file class.assQuestion.php.

{
return FALSE;
}
assQuestion::syncFeedbackGeneric ( )

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

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

Referenced by syncWithOriginal().

{
global $ilDB;
$feedback = "";
// delete generic feedback of the original
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_fb_generic WHERE question_fi = %s",
array('integer'),
array($this->original_id)
);
// get generic feedback of the actual question
$result = $ilDB->queryF("SELECT * FROM qpl_fb_generic WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
// save generic feedback to the original
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$next_id = $ilDB->nextId('qpl_fb_generic');
$affectedRows = $ilDB->manipulateF("INSERT INTO qpl_fb_generic (feedback_id, question_fi, correctness, feedback, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','integer','text','text','integer'),
array($next_id, $this->original_id, $row["correctness"], $row["feedback"], time())
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::syncSuggestedSolutionFiles (   $original_id)
protected

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

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

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

Referenced by updateSuggestedSolutions().

{
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:

+ Here is the caller graph for this function:

assQuestion::syncWithOriginal ( )

Reimplemented in assSingleChoice, assMultipleChoice, and assImagemapQuestion.

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

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

{
global $ilDB;
if ($this->getOriginalId())
{
$id = $this->getId();
$original = $this->getOriginalId();
$this->setId($this->getOriginalId());
$this->setOriginalId(NULL);
$this->saveToDb();
$this->deletePageOfQuestion($original);
$this->createPageObject();
$this->setId($id);
$this->setOriginalId($original);
$this->updateSuggestedSolutions($original);
}
}

+ Here is the call graph for this function:

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

Definition at line 1589 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, assErrorText, and assOrderingHorizontal.

Definition at line 250 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:

assQuestion::updateSuggestedSolutions (   $original_id = "")

Update the suggested solutions of a question based on the suggested solution array attribute.

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

References $id, $ilDB, $original_id, ilInternalLink\_deleteAllLinksOfSource(), ilRTE\_replaceMediaObjectImageSrc(), ilInternalLink\_saveLink(), cleanupMediaObjectUsage(), getId(), and syncSuggestedSolutionFiles().

Referenced by saveToDb(), and syncWithOriginal().

{
global $ilDB;
$id = (strlen($original_id) && is_numeric($original_id)) ? $original_id : $this->getId();
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s",
array('integer'),
array($id)
);
include_once("./Services/RTE/classes/class.ilRTE.php");
foreach ($this->suggested_solutions as $index => $solution)
{
$next_id = $ilDB->nextId('qpl_sol_sug');
$affectedRows = $ilDB->manipulateF("INSERT INTO qpl_sol_sug (suggested_solution_id, question_fi, type, value, internal_link, import_id, subquestion_index, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
array("integer","integer", "text", "text", "text", "text", "integer","integer"),
array(
$next_id,
$id,
$solution["type"],
ilRTE::_replaceMediaObjectImageSrc((is_array($solution["value"])) ? serialize($solution["value"]) : $solution["value"], 0),
$solution["internal_link"],
NULL,
$index,
time()
)
);
if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches))
{
ilInternalLink::_saveLink("qst", $id, $matches[2], $matches[3], $matches[1]);
}
}
if (strlen($original_id) && is_numeric($original_id)) $this->syncSuggestedSolutionFiles($id);
}

+ Here is the call graph for this function:

+ Here is the caller 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::$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(), getObjId(), and setObjId().

assQuestion::$original_id
protected

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

Referenced by _logAction(), assFileUpload\copyObject(), assOrderingHorizontal\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assErrorText\copyObject(), assFlashQuestion\copyObject(), assNumeric\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assJavaApplet\copyObject(), assClozeTest\copyObject(), assFileUpload\duplicate(), assOrderingHorizontal\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assTextQuestion\duplicate(), assErrorText\duplicate(), assNumeric\duplicate(), assOrderingQuestion\duplicate(), assTextSubset\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assSingleChoice\duplicate(), assJavaApplet\duplicate(), assClozeTest\duplicate(), assImagemapQuestion\duplicateFeedbackAnswer(), assMultipleChoice\duplicateFeedbackAnswer(), assSingleChoice\duplicateFeedbackAnswer(), duplicateFeedbackGeneric(), getOriginalId(), logAction(), saveQuestionDataToDb(), assFileUpload\saveToDb(), assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assNumeric\saveToDb(), assTextQuestion\saveToDb(), assTextSubset\saveToDb(), assMultipleChoice\saveToDb(), assOrderingQuestion\saveToDb(), assSingleChoice\saveToDb(), assImagemapQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assClozeTest\saveToDb(), assJavaApplet\saveToDb(), setOriginalId(), and updateSuggestedSolutions().

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(), assSingleChoice\addAnswer(), assMultipleChoice\addAnswer(), assImagemapQuestion\addAnswer(), assErrorText\addErrorData(), assMatchingQuestion\addMatchingPair(), assFileUpload\calculateReachedPoints(), 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(), calculateReachedPoints(), assErrorText\getBestSelection(), assClozeTest\getMaximumGapPoints(), assTextQuestion\getMaximumPoints(), assFlashQuestion\getMaximumPoints(), assTextSubset\getMaximumPoints(), assSingleChoice\getMaximumPoints(), assMultipleChoice\getMaximumPoints(), assImagemapQuestion\getMaximumPoints(), assClozeTest\getMaximumPoints(), getMaximumPoints(), assMatchingQuestion\getMaximumPoints(), getPoints(), assErrorText\getPointsForSelectedPositions(), 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: