ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assQuestion Class Reference

Abstract basic class which is to be extended by the concrete assessment question type classes. More...

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

Public Member Functions

 __construct ($title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor
 setProcessLocker ($processLocker)
 getProcessLocker ()
 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.
 supportsNonJsOutput ()
 requiresJsSwitch ()
 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.
 setExternalId ($external_id)
 getExternalId ()
 _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.
 getAdjustedReachedPoints ($active_id, $pass=NULL)
 returns the reached points ...
 calculateResultsFromSolution ($active_id, $pass=NULL, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution.
 persistWorkingState ($active_id, $pass=NULL, $obligationsEnabled=false)
 persists the working state for current testactive and testpass
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database.
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place.
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log.
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log.
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it.
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution.
 getJavaPath ()
 Returns the image path for web accessable images of a question.
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question.
 getFlashPath ()
 Returns the image path for web accessable flash files of a question.
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question.
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution.
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question.
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question.
getSolutionValues ($active_id, $pass=NULL)
 Loads solutions of a given user from the database an returns it.
 isInUse ($question_id="")
 Checks whether the question is in use or not.
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not.
 pcArrayShuffle ($array)
 Shuffles the values of a given array.
 getQuestionTypeFromDb ($question_id)
 get question type for question id
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database.
 getAnswerTableName ()
 Returns the name of the answer table in the database.
 deleteAnswers ($question_id)
 Deletes datasets from answers tables.
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database.
 delete ($question_id)
 Deletes a question and all materials from the database.
 getTotalAnswers ()
 get total number of answers
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method
 _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method
 _getTitle ($a_q_id)
 Returns the title of a question.
 _getQuestionText ($a_q_id)
 Returns question text.
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 syncXHTMLMediaObjectsOfQuestion ()
 createPageObject ()
 create page object of question
 copyPageOfQuestion ($a_q_id)
 getPageOfQuestion ()
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id.
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id.
 setOriginalId ($original_id)
 getOriginalId ()
 loadFromDb ($question_id)
 Loads the question from the database.
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.
 saveQuestionDataToDb ($original_id="")
 saveToDb ($original_id="")
 Saves the question to the database.
 setNewOriginalId ($newId)
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database.
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index.
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index.
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question.
 _resolveInternalLink ($internal_link)
 _resolveIntLinks ($question_id)
 _getInternalLinkHref ($target="")
 syncWithOriginal ()
 createRandomSolution ($test_id, $user_id)
 _questionExists ($question_id)
 Returns true if the question already exists in the database.
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool.
 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, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question.
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=NULL)
 Adjust the given reached points by 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, $manualscoring, $obligationsEnabled)
 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.
 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.
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question.
 __get ($value)
 Object getter.
 __set ($key, $value)
 Object setter.
 getNrOfTries ()
 setNrOfTries ($a_nr_of_tries)
 setExportImagePath ($a_path)
 _questionExistsInTest ($question_id, $test_id)
 formatSAQuestion ($a_q)
 Format self assessment question.
 setPreventRteUsage ($a_val)
 Set prevent rte usage.
 getPreventRteUsage ()
 Get prevent rte usage.
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode.
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode.
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries.
 getDefaultNrOfTries ()
 Get Default Nr of Tries.
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not
 setObligationsToBeConsidered ($obligationsToBeConsidered=true)
 sets the flag wether obligations are to be considered or not
 areObligationsToBeConsidered ()
 gets the flag wether obligations are to be considered or not
 isAutosaveable ()
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 getQuestionChangeListeners ()
 getHtmlUserSolutionPurifier ()
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)

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 _getOriginalId ($question_id)
 Returns the original id of a question.
static originalQuestionExists ($questionId)
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id.
static _instantiateQuestion ($question_id)
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 getGuiClassNameByQuestionType ($questionType)
static getObjectClassNameByQuestionType ($questionType)
static getFeedbackClassNameByQuestionType ($questionType)
static isCoreQuestionType ($questionType)
static includeCoreClass ($questionType, $withGuiClass)
static includePluginClass ($questionType, $withGuiClass)
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag.
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id.
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id.
static lookupParentObjId ($questionId)
 ilDB $ilDB
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too)
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration

Data Fields

const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default"
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject"
 $feedbackOBJ = null
 $prevent_rte_usage = false
 $selfassessmenteditingmode = false
 $defaultnroftries = false

Protected Member Functions

 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary.
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID.
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test)
 onSyncWithOriginal ($originalQuestionId, $duplicateQuestionId)
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool)
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated.
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced.
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)

Static Protected Member Functions

static doesSolutionRecordsExist ($activeId, $pass, $questionId)
 checks wether there are existing solution records for the given test active / pass and given 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
 $external_id = ''
 $questionChangeListeners = array()
 $processLocker

Private Member Functions

 notifyQuestionCreated ()
 notifyQuestionEdited ()
 notifyQuestionDeleted ()

Private Attributes

 $nr_of_tries
 Number of tries.
 $arrData
 Associative array to store properties.
 $export_image_path
 (Web) Path to images
 $obligationsToBeConsidered = false
 $additinalContentEditingMode = null

Detailed Description

Abstract basic class which is to be extended by the concrete assessment question type classes.

The assQuestion class defines and encapsulates basic/common methods and attributes as well as it provides abstract methods that are to be implemented by concrete question type 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
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
Id:
class.assQuestion.php 61152 2015-10-19 13:00:09Z gitmgr

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

Constructor & Destructor Documentation

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

assQuestion constructor

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

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

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

References $author, $comment, $ilias, $lng, $owner, $question, $title, $tpl, OUTPUT_HTML, setEstimatedWorkingTime(), setExternalId(), 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();
$this->setExternalId('');
}

+ Here is the call graph for this function:

Member Function Documentation

assQuestion::__get (   $value)

Object getter.

Reimplemented in assFormulaQuestion, assErrorText, assFileUpload, and assOrderingHorizontal.

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

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

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

+ Here is the call graph for this function:

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

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

Parameters
intuser_id
array$question_idsuser id array
Returns
boolean

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

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

References $target_id.

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

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

+ Here is the caller graph for this function:

assQuestion::_getMaximumPoints (   $question_id)

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

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

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

References $points, $result, and $row.

Referenced by _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), ilTestScoringGUI\buildManScoringParticipantForm(), assFileUpload\handleSubmission(), ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter(), and ilTestScoringGUI\saveManScoringParticipantScreen().

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

static assQuestion::_getOriginalId (   $question_id)
static

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

References $result.

Referenced by _logAction(), ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilObjTestGUI\copyAndLinkToQuestionpoolObject(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assNumeric\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assFlashQuestion\copyObject(), assOrderingQuestion\copyObject(), assErrorText\copyObject(), assTextSubset\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assMatchingQuestion\copyObject(), assJavaApplet\copyObject(), assFormulaQuestion\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assImagemapQuestion\duplicate(), assTextQuestion\duplicate(), assFlashQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assJavaApplet\duplicate(), assFormulaQuestion\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 722 of file class.assQuestion.php.

References $result.

Referenced by ilObjMediaObject\getParentObjectIdForUsage(), and ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter().

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

References $result.

Referenced by ilLMQuestionListTableGUI\fillRow().

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

+ Here is the caller graph for this function:

assQuestion::_getQuestionTitle (   $question_id)

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

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

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

References $result.

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

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

+ Here is the caller graph for this function:

assQuestion::_getQuestionType (   $question_id)

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

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

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

References $result.

Referenced by _instantiateQuestion(), _needsManualScoring(), ilPageObjectGUI\executeCommand(), ilObjectivesAlignmentTableGUI\fillRow(), instantiateQuestionGUI(), ilObjTest\isQuestionObligationPossible(), and ilPCQuestionGUI\setTabs().

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

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

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

Referenced by ilTestScoringGUI\buildManScoringParticipantForm(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), getReachedPoints(), and ilTestPlayerDynamicQuestionSetGUI\isQuestionAnsweredCorrect().

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

References $result.

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

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

References $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 760 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 1916 of file class.assQuestion.php.

References $result.

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

References $result.

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

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

References includeCoreClass(), and includePluginClass().

Referenced by assQuestionGUI\_getQuestionGUI(), _instantiateQuestion(), ilObjQuestionPool\createQuestion(), ilObjTest\createQuestionGUI(), ilQTIParser\handlerParseEndTag(), instantiateQuestionGUI(), and ilObjTest\isQuestionObligationPossible().

{
if( self::isCoreQuestionType($question_type) )
{
self::includeCoreClass($question_type, $gui);
}
else
{
self::includePluginClass($question_type, $gui);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static& assQuestion::_instanciateQuestionGUI (   $question_id)
static

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

Parameters
integer$question_idThe question id
Returns
The question gui instance
Deprecated:
Use instantiateQuestionGUI (without legacy underscore & typos) instead. public

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

References instantiateQuestionGUI().

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

{
return self::instantiateQuestionGUI($question_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::_instantiateQuestion (   $question_id)
static

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

References $ilCtrl, $lng, $question, _getQuestionType(), _includeClass(), getFeedbackClassNameByQuestionType(), and getObjectClassNameByQuestionType().

Referenced by _instanciateQuestion(), and ilAssIncompleteQuestionPurger\purgeQuestionIds().

{
global $ilCtrl, $ilDB, $lng;
if (strcmp($question_id, "") != 0)
{
$question_type = assQuestion::_getQuestionType($question_id);
if (!strlen($question_type)) return null;
assQuestion::_includeClass($question_type);
$objectClassname = self::getObjectClassNameByQuestionType($question_type);
$question = new $objectClassname();
$question->loadFromDb($question_id);
$feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
$question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
return $question;
}
}

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

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

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

References $result.

Referenced by ilAssQuestionFeedbackEditingGUI\isSyncAfterSaveRequired(), ilAssQuestionHintsGUI\performDeleteCmd(), assQuestionGUI\save(), assQuestionGUI\saveEdit(), ilAssQuestionHintGUI\saveFormCmd(), ilAssQuestionHintsGUI\saveListOrderCmd(), assQuestionGUI\saveReturn(), assFormulaQuestionGUI\saveReturnFQ(), 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 1315 of file class.assQuestion.php.

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

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::_questionExists (   $question_id)

Returns true if the question already exists in the database.

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

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

References $result.

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

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

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

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

References $result.

Referenced by assQuestionGUI\outQuestionType().

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

+ Here is the caller graph for this function:

assQuestion::_questionExistsInTest (   $question_id,
  $test_id 
)

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

References $result, and $test_id.

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

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

+ Here is the caller graph for this function:

assQuestion::_resolveInternalLink (   $internal_link)

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

References $result, 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,
  $manualscoring,
  $obligationsEnabled 
)

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

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

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

{
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;
$rowsnum = $result->numRows();
if($rowsnum)
{
$row = $ilDB->fetchAssoc($result);
$old_points = $row["points"];
if($old_points != $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())
);
}
if($old_points != $points || !$rowsnum)
{
assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
// 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::_updateTestResultCache (   $active_id,
ilAssQuestionProcessLocker  $processLocker = null 
)

Move this to a proper place.

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

References $pass, $processLocker, $query, $result, $row, and ilObjTest\_getResultPass().

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

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

+ 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 3176 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::addQuestionChangeListener ( ilQuestionChangeListener  $listener)
Parameters
ilQuestionChangeListener$listener

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

Referenced by ilObjQuestionPool\addQuestionChangeListeners().

{
$this->questionChangeListeners[] = $listener;
}

+ Here is the caller graph for this function:

assQuestion::adjustReachedPointsByScoringOptions (   $points,
  $active_id,
  $pass = NULL 
)
final

Adjust the given reached points by checks for all special scoring options in the test container.

public

Parameters
integer$points
integer$active_id
integer$pass

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

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

{
include_once "./Modules/Test/classes/class.ilObjTest.php";
$count_system = ilObjTest::_getCountSystem($active_id);
if ($count_system == 1)
{
if (abs($this->getMaximumPoints() - $points) > 0.0000000001)
{
$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::areObligationsToBeConsidered ( )

gets the flag wether obligations are to be considered or not

Returns
bool $obligationsToBeConsidered

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

References $obligationsToBeConsidered.

assQuestion::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $returndetails = FALSE 
)
abstract

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

The points are calculated from the given answers.

public

Parameters
integer$active_id
integer$pass
boolean$returndetails(deprecated !!)
Returns
integer/array $points/$details (array $details is deprecated !!)

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

+ Here is the caller graph for this function:

assQuestion::calculateResultsFromSolution (   $active_id,
  $pass = NULL,
  $obligationsEnabled = false 
)
final

Calculates the question results from a previously saved question solution.

ilDB $ilDB ilObjUser $ilUser

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

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

References $ilUser, $pass, $query, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), ilCourseObjectiveResult\_updateObjectiveResult(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), getId(), getProcessLocker(), ilAssQuestionHintTracking\getRequestStatisticDataByQuestionAndTestpass(), isAnswered(), ilObjTest\isQuestionObligatory(), and logAction().

Referenced by persistWorkingState().

{
global $ilDB, $ilUser;
if( is_null($pass) )
{
include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
}
// determine reached points for submitted solution
$reached_points = $this->calculateReachedPoints($active_id, $pass);
// deduct points for requested hints from reached points
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
$reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
// adjust reached points regarding to tests scoring options
$reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
if( $obligationsEnabled && ilObjTest::isQuestionObligatory($this->getId()) )
{
$isAnswered = $this->isAnswered($active_id, $pass);
}
else
{
$isAnswered = true;
}
if( is_null($reached_points) ) $reached_points = 0;
$this->getProcessLocker()->requestUserQuestionResultUpdateLock();
$query = "
DELETE FROM tst_test_result
WHERE active_fi = %s
AND question_fi = %s
AND pass = %s
";
$affectedRows = $ilDB->manipulateF(
$query, array("integer", "integer", "integer"), array($active_id, $this->getId(), $pass)
);
$next_id = $ilDB->nextId("tst_test_result");
$ilDB->insert('tst_test_result', array(
'test_result_id' => array('integer', $next_id),
'active_fi' => array('integer', $active_id),
'question_fi' => array('integer', $this->getId()),
'pass' => array('integer', $pass),
'points' => array('float', $reached_points),
'tstamp' => array('integer', time()),
'hint_count' => array('integer', $requestsStatisticData->getRequestsCount()),
'hint_points' => array('float', $requestsStatisticData->getRequestsPoints()),
'answered' => array('integer', $isAnswered)
));
$this->getProcessLocker()->releaseUserQuestionResultUpdateLock();
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, $obligationsEnabled, $this->getProcessLocker());
// 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 3421 of file class.assQuestion.php.

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

Referenced by saveToDb().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::copyPageOfQuestion (   $a_q_id)

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

References $page.

Referenced by syncWithOriginal().

{
if ($a_q_id > 0)
{
include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
$page = new ilAssQuestionPage($a_q_id);
$xml = str_replace("il__qst_".$a_q_id, "il__qst_".$this->id, $page->getXMLContent());
$this->page->setXMLContent($xml);
$this->page->updateFromXML();
}
}

+ Here is the caller graph for this function:

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

Definition at line 2463 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 1958 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 3213 of file class.assQuestion.php.

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

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

Returns
integer ID of the new question

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

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

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

+ Here is the call graph for this function:

assQuestion::createPageObject ( )

create page object of question

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

References getId(), and getObjId().

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

{
$qpl_id = $this->getObjId();
include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
$this->page = new ilAssQuestionPage(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 2786 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 1686 of file class.assQuestion.php.

References $ilLog, $mobs, $obj_id, $result, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), ilUtil\delDir(), deleteAdditionalTableData(), deleteAnswers(), ilAssQuestionHintList\deleteHintsByQuestionIds(), deletePageOfQuestion(), ilAssQuestionHintTracking\deleteRequestsByQuestionIds(), getObjId(), isAdditionalContentEditingModePageObject(), and notifyQuestionDeleted().

{
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);
$this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
$this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
}
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;
}
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
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;
}
$this->notifyQuestionDeleted($this);
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 1637 of file class.assQuestion.php.

References 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 assFormulaQuestion, assFileUpload, assFlashQuestion, and assOrderingHorizontal.

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

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

References $page.

Referenced by delete(), and syncWithOriginal().

{
include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
$page = new ilAssQuestionPage($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 2316 of file class.assQuestion.php.

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

static assQuestion::doesSolutionRecordsExist (   $activeId,
  $pass,
  $questionId 
)
staticprotected

checks wether there are existing solution records for the given test active / pass and given question id

protected ilDB $ilDB

Parameters
integer$activeId
integer$pass
integer$questionId
Returns
boolean $solutionRecordsExist

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

References $query, and $res.

Referenced by assTextQuestion\isAnswered(), assFileUpload\isAnswered(), assSingleChoice\isAnswered(), and assMultipleChoice\isAnswered().

{
// check if a solution was stored in tst_solution
global $ilDB;
$query = "
SELECT count(active_fi) cnt
FROM tst_solutions
WHERE active_fi = %s
AND question_fi = %s
AND pass = %s
";
$res = $ilDB->queryF(
$query, array('integer','integer','integer'),
array($activeId, $questionId, $pass)
);
$row = $ilDB->fetchAssoc($res);
$solutionRecordsExist = (
0 < (int)$row['cnt'] ? true : false
);
return $solutionRecordsExist;
}

+ Here is the caller graph for this function:

assQuestion::duplicate (   $for_test = true,
  $title = "",
  $author = "",
  $owner = "",
  $testObjId = null 
)
abstract
assQuestion::duplicateQuestionHints (   $originalQuestionId,
  $duplicateQuestionId 
)
protected

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

References ilAssQuestionHintList\duplicateListForQuestion(), getId(), and isAdditionalContentEditingModePageObject().

Referenced by onCopy(), and onDuplicate().

{
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
$hintIds = ilAssQuestionHintList::duplicateListForQuestion($originalQuestionId, $duplicateQuestionId);
{
require_once 'Modules/TestQuestionPool/classes/class.ilAssHintPage.php';
foreach($hintIds as $originalHintId => $duplicateHintId)
{
$originalPageObject = new ilAssHintPage($originalHintId);
$originalXML = $originalPageObject->getXMLContent();
$duplicatePageObject = new ilAssHintPage();
$duplicatePageObject->setId($duplicateHintId);
$duplicatePageObject->setParentId($this->getId());
$duplicatePageObject->setXMLContent($originalXML);
$duplicatePageObject->createFromXML();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

Referenced by onDuplicate().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::formatSAQuestion (   $a_q)

Format self assessment question.

Parameters
@return

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

References ilRTE\_replaceMediaObjectImageSrc(), and ilUtil\insertLatexImages().

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

{
include_once("./Services/RTE/classes/class.ilRTE.php");
$a_q = nl2br((string) ilRTE::_replaceMediaObjectImageSrc($a_q, 0));
$a_q = str_replace("</li><br />", "</li>", $a_q);
$a_q = str_replace("</li><br>", "</li>", $a_q);
$a_q = ilUtil::insertLatexImages($a_q, "\[tex\]", "\[\/tex\]");
$a_q = ilUtil::insertLatexImages($a_q, "<span class\=\"latex\">", "<\/span>");
$a_q = str_replace('{', '&#123;', $a_q);
$a_q = str_replace('}', '&#125;', $a_q);
return $a_q;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Reimplemented in assFileUpload, assOrderingHorizontal, assFlashQuestion, and assErrorText.

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

References $result.

{
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::getAdditionalContentEditingMode ( )

getter for additional content editing mode for this question

public

Returns
string

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

References $additinalContentEditingMode.

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

+ Here is the caller graph for this function:

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

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

Referenced by deleteAdditionalTableData().

{
return "";
}

+ Here is the caller graph for this function:

assQuestion::getAdjustedReachedPoints (   $active_id,
  $pass = NULL 
)
final

returns the reached points ...

  • calculated by concrete question type class
  • adjusted by hint point deduction
  • adjusted by scoring options ... for given testactive and testpass
Parameters
integer$active_id
integer$pass
Returns
integer $reached_points

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

References $pass, ilObjTest\_getPass(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), getId(), and ilAssQuestionHintTracking\getRequestStatisticDataByQuestionAndTestpass().

{
if (is_null($pass))
{
include_once "./Modules/Test/classes/class.ilObjTest.php";
$pass = ilObjTest::_getPass($active_id);
}
// determine reached points for submitted solution
$reached_points = $this->calculateReachedPoints($active_id, $pass);
// deduct points for requested hints from reached points
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
$reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
// adjust reached points regarding to tests scoring options
$reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
return $reached_points;
}

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

Definition at line 1591 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 622 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 561 of file class.assQuestion.php.

References $comment.

Referenced by __get(), and saveQuestionDataToDb().

{
}

+ Here is the caller graph for this function:

assQuestion::getDefaultNrOfTries ( )

Get Default Nr of Tries.

Returns
int Default Nr of Tries

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

References $defaultnroftries.

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 606 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::getExternalId ( )
Returns
string

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

References $external_id, and getId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

{
if(!strlen($this->external_id))
{
if($this->getId() > 0)
{
return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
}
else
{
return uniqid('', true);
}
}
else
{
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::getFeedbackClassNameByQuestionType (   $questionType)
static

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

Referenced by assQuestionGUI\_getQuestionGUI(), _instantiateQuestion(), ilObjTest\createQuestionGUI(), includeCoreClass(), and instantiateQuestionGUI().

{
return str_replace('ass', 'ilAss', $questionType).'Feedback';
}

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

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

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

static assQuestion::getGuiClassNameByQuestionType (   $questionType)
static

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

Referenced by assQuestionGUI\_getQuestionGUI(), ilObjTest\createQuestionGUI(), includeCoreClass(), includePluginClass(), instantiateQuestionGUI(), and isCoreQuestionType().

{
return $questionType.'GUI';
}

+ Here is the caller graph for this function:

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

References ilHtmlPurifierFactory\_getInstanceByType().

{
require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
}

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

References $id.

Referenced by ilAssQuestionHintsOrderingClipboard\__construct(), __get(), addQTIMaterial(), assOrderingHorizontal\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assFlashQuestion\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assOrderingQuestion\calculateReachedPoints(), assJavaApplet\calculateReachedPoints(), assImagemapQuestion\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assClozeTest\calculateReachedPoints(), calculateResultsFromSolution(), assMatchingQuestion\checkSaveData(), cleanupMediaObjectUsage(), assErrorText\copyObject(), assClozeTest\copyObject(), copyXHTMLMediaObjectsOfQuestion(), createNewQuestion(), createPageObject(), deleteSuggestedSolutions(), ilDynamicTestQuestionChangeListener\deleteTestsParticipantsQuestionData(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assImagemapQuestion\duplicate(), assTextQuestion\duplicate(), assFlashQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assJavaApplet\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), assTextQuestion\duplicateAnswers(), duplicateQuestionHints(), getAdjustedReachedPoints(), getExternalId(), assFileUpload\getFileUploadPath(), assFileUpload\getFileUploadPathWeb(), getInstances(), assOrderingQuestion\getOldLeveledOrdering(), assJavaApplet\getReachedInformation(), getReachedPoints(), assImagemapQuestion\getRTETextWithMediaObjects(), assMultipleChoice\getRTETextWithMediaObjects(), assSingleChoice\getRTETextWithMediaObjects(), getRTETextWithMediaObjects(), getSolutionMaxPass(), getSolutionValues(), assFileUpload\getUploadedFiles(), assFileUpload\handleSubmission(), assFileUpload\hasFileUploads(), assTextQuestion\isAnswered(), assFileUpload\isAnswered(), assSingleChoice\isAnswered(), assMultipleChoice\isAnswered(), isInUse(), assTextQuestion\loadFromDb(), loadFromDb(), assOrderingHorizontal\moveRight(), assFileUpload\saveAdditionalQuestionDataToDb(), assFlashQuestion\saveAdditionalQuestionDataToDb(), assErrorText\saveAdditionalQuestionDataToDb(), assImagemapQuestion\saveAdditionalQuestionDataToDb(), assMatchingQuestion\saveAdditionalQuestionDataToDb(), assJavaApplet\saveAdditionalQuestionDataToDb(), assClozeTest\saveAdditionalQuestionDataToDb(), assOrderingHorizontal\saveAdditionalQuestionDataToDb(), assErrorText\saveAnswerSpecificDataToDb(), assImagemapQuestion\saveAnswerSpecificDataToDb(), assMatchingQuestion\saveAnswerSpecificDataToDb(), assClozeTest\saveAnswerSpecificDataToDb(), assClozeTest\saveClozeNumericGapRecordToDb(), assClozeTest\saveClozeSelectGapRecordToDb(), assClozeTest\saveClozeTextGapRecordToDb(), saveQuestionDataToDb(), assMultipleChoice\saveToDb(), assFormulaQuestion\saveToDb(), saveToDb(), assOrderingHorizontal\saveWorkingData(), assErrorText\saveWorkingData(), assFileUpload\saveWorkingData(), assTextSubset\saveWorkingData(), assSingleChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), assImagemapQuestion\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assFormulaQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), assClozeTest\saveWorkingData(), assFormulaQuestion\setId(), setNewOriginalId(), assTextQuestion\setReachedPoints(), assFormulaQuestion\substituteVariables(), syncWithOriginal(), syncXHTMLMediaObjectsOfQuestion(), assErrorText\toggleSelection(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assTextQuestion\toJSON(), assImagemapQuestion\toJSON(), assSingleChoice\toJSON(), assMultipleChoice\toJSON(), assOrderingQuestion\toJSON(), assErrorText\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
return $this->id;
}

+ Here is the caller graph for this function:

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

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

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

public

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

References $id, and $obj_id.

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

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

+ Here is the caller graph for this function:

assQuestion::getImagePathWeb ( )

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

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

public

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

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& assQuestion::getInstances ( )

Gets all instances of the question.

Returns
array All instances of question and its copies

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

References $result, 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 1369 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 1411 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, assFormulaQuestion, assClozeTest, assOrderingQuestion, assImagemapQuestion, assSingleChoice, assMultipleChoice, assTextSubset, assFlashQuestion, assTextQuestion, assErrorText, assNumeric, assFileUpload, and assOrderingHorizontal.

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

References $points.

Referenced by adjustReachedPointsByScoringOptions(), and saveQuestionDataToDb().

{
return $this->points;
}

+ Here is the caller graph for this function:

static assQuestion::getObjectClassNameByQuestionType (   $questionType)
static

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

Referenced by _instantiateQuestion(), and includeCoreClass().

{
return $questionType;
}

+ Here is the caller graph for this function:

assQuestion::getObjId ( )

Get the object id of the container object.

Returns
integer The object id of the container object public
See Also
$obj_id

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

References $obj_id.

Referenced by __get(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assNumeric\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assFlashQuestion\copyObject(), assOrderingQuestion\copyObject(), assErrorText\copyObject(), assTextSubset\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assMatchingQuestion\copyObject(), assJavaApplet\copyObject(), assFormulaQuestion\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\createNewOriginalFromThisDuplicate(), assFileUpload\createNewOriginalFromThisDuplicate(), assNumeric\createNewOriginalFromThisDuplicate(), assImagemapQuestion\createNewOriginalFromThisDuplicate(), assTextQuestion\createNewOriginalFromThisDuplicate(), assFlashQuestion\createNewOriginalFromThisDuplicate(), assOrderingQuestion\createNewOriginalFromThisDuplicate(), assErrorText\createNewOriginalFromThisDuplicate(), assTextSubset\createNewOriginalFromThisDuplicate(), assMultipleChoice\createNewOriginalFromThisDuplicate(), assSingleChoice\createNewOriginalFromThisDuplicate(), assMatchingQuestion\createNewOriginalFromThisDuplicate(), assJavaApplet\createNewOriginalFromThisDuplicate(), assFormulaQuestion\createNewOriginalFromThisDuplicate(), assClozeTest\createNewOriginalFromThisDuplicate(), createNewQuestion(), createPageObject(), delete(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assImagemapQuestion\duplicate(), assTextQuestion\duplicate(), assFlashQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assJavaApplet\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), and saveQuestionDataToDb().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

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

Gets the output type.

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

Reimplemented in assSingleChoice, and assMultipleChoice.

Definition at line 573 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 634 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 2008 of file class.assQuestion.php.

References $page.

{
include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
$page = new ilAssQuestionPage($this->id);
return $page->getXMLContent();
}
assQuestion::getPoints ( )
assQuestion::getPreventRteUsage ( )

Get prevent rte usage.

Returns
boolean prevent rte usage

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

References $prevent_rte_usage.

assQuestion::getQuestionChangeListeners ( )
Returns
array[ilQuestionChangeListener]

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

References $questionChangeListeners.

Referenced by notifyQuestionCreated(), notifyQuestionDeleted(), and notifyQuestionEdited().

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

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

References $result.

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

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

+ Here is the caller graph for this function:

assQuestion::getQuestionTypeID ( )

Returns the question type of the question.

Returns the question type of the question

Returns
integer The question type of the question public

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

References $result, 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 873 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, assFormulaQuestion, assOrderingQuestion, assSingleChoice, assMultipleChoice, assJavaApplet, assImagemapQuestion, assTextQuestion, assTextSubset, assFileUpload, assNumeric, assFlashQuestion, assOrderingHorizontal, and assErrorText.

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

References getId(), getQuestion(), and getTotalAnswers().

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->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
$collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
for( $i = 0; $i <= $this->getTotalAnswers(); $i++ )
{
$collected .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->getId(), $i);
}
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::getSelfAssessmentEditingMode ( )

Get Self-Assessment Editing Mode.

Returns
boolean Self-Assessment Editing Mode

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

References $selfassessmenteditingmode.

assQuestion::getShuffle ( )

Gets the shuffle flag.

Returns
boolean The shuffle flag public
See Also
$shuffle

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

References $shuffle.

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

References $result, getId(), and getSolutionMaxPass().

Referenced by assFormulaQuestion\calculateReachedPoints(), assFormulaQuestion\getBestSolution(), assOrderingHorizontal\moveRight(), assErrorText\setExportDetailsXLS(), assOrderingHorizontal\setExportDetailsXLS(), assNumeric\setExportDetailsXLS(), assFileUpload\setExportDetailsXLS(), assTextSubset\setExportDetailsXLS(), assTextQuestion\setExportDetailsXLS(), assImagemapQuestion\setExportDetailsXLS(), assJavaApplet\setExportDetailsXLS(), assMultipleChoice\setExportDetailsXLS(), assSingleChoice\setExportDetailsXLS(), assOrderingQuestion\setExportDetailsXLS(), assFormulaQuestion\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 2338 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 767 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":
$possible_texts = array_values(array_filter(array(
ilUtil::prepareFormOutput($solution['value']['filename']),
ilUtil::prepareFormOutput($solution['value']['name']),
$this->lng->txt('tst_show_solution_suggested')
)));
array_push($output, '<a href="' . $this->getSuggestedSolutionPathWeb() . $solution["value"]["name"] . '">' . $possible_texts[0] . '</a>');
break;
case "text":
array_push($output, $this->prepareTextareaOutput($solution["value"], true));
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 1359 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 1423 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 831 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 2358 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 549 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 1827 of file class.assQuestion.php.

References _getTotalAnswers().

Referenced by getRTETextWithMediaObjects().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::getValidAdditionalContentEditingModes ( )

getter for valid additional content editing modes

public

Returns
array

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

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

{
return array(
self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
);
}

+ Here is the caller graph for this function:

static assQuestion::includeCoreClass (   $questionType,
  $withGuiClass 
)
static

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

References getFeedbackClassNameByQuestionType(), getGuiClassNameByQuestionType(), and getObjectClassNameByQuestionType().

Referenced by _includeClass().

{
if( $withGuiClass )
{
$guiClassName = self::getGuiClassNameByQuestionType($questionType);
require_once "Modules/TestQuestionPool/classes/class.{$guiClassName}.php";
// object class is included by gui classes constructor
}
else
{
$objectClassName = self::getObjectClassNameByQuestionType($questionType);
require_once "Modules/TestQuestionPool/classes/class.{$objectClassName}.php";
}
$feedbackClassName = self::getFeedbackClassNameByQuestionType($questionType);
require_once "Modules/TestQuestionPool/classes/feedback/class.{$feedbackClassName}.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::includePluginClass (   $questionType,
  $withGuiClass 
)
static

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

References getGuiClassNameByQuestionType(), ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by _includeClass().

{
global $ilPluginAdmin;
$classes = array(
self::getObjectClassNameByQuestionType($questionType),
self::getFeedbackClassNameByQuestionType($questionType)
);
if( $withGuiClass )
{
$classes[] = self::getGuiClassNameByQuestionType($questionType);
}
$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(), $questionType) == 0)
{
foreach($classes as $class)
{
$pl->includeClass("class.{$class}.php");
}
break;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::instantiateQuestionGUI (   $a_question_id)
static

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

Parameters
integer$a_question_id
Returns
The question gui instance

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

References $ilCtrl, $ilLog, $ilUser, $lng, ilObjAssessmentFolder\_enabledAssessmentLogging(), _getQuestionType(), _includeClass(), getFeedbackClassNameByQuestionType(), and getGuiClassNameByQuestionType().

Referenced by _instanciateQuestionGUI(), and ilObjTestGUI\copyQuestionToPool().

{
global $ilCtrl, $ilDB, $lng, $ilUser;
if (strcmp($a_question_id, "") != 0)
{
$question_type = assQuestion::_getQuestionType($a_question_id);
assQuestion::_includeClass($question_type, 1);
$question_type_gui = self::getGuiClassNameByQuestionType($question_type);
$question_gui = new $question_type_gui();
$question_gui->object->loadFromDb($a_question_id);
$feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
$question_gui->object->feedbackOBJ = new $feedbackObjectClassname($question_gui->object, $ilCtrl, $ilDB, $lng);
$assSettings = new ilSetting('assessment');
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
$processLockerFactory = new ilAssQuestionProcessLockerFactory($assSettings, $ilDB);
$processLockerFactory->setQuestionId($question_gui->object->getId());
$processLockerFactory->setUserId($ilUser->getId());
include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
$processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
$question_gui->object->setProcessLocker($processLockerFactory->getLocker());
}
else
{
global $ilLog;
$ilLog->write('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', $ilLog->WARNING);
return null;
}
return $question_gui;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::isAdditionalContentEditingModePageObject ( )

isser for additional "pageobject" content editing mode

public

Returns
boolean

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

References ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, and getAdditionalContentEditingMode().

Referenced by delete(), and duplicateQuestionHints().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::isAnswered (   $active_id,
  $pass = null 
)

returns boolean wether the question is answered during test pass or not

method can be overwritten in derived classes, but be aware of also overwrite the method assQuestion::isObligationPossible()

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

Reimplemented in assMultipleChoice, assSingleChoice, assFileUpload, and assTextQuestion.

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

Referenced by calculateResultsFromSolution().

{
return true;
}

+ Here is the caller graph for this function:

assQuestion::isAutosaveable ( )

Reimplemented in assFileUpload, assJavaApplet, and assFlashQuestion.

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

{
return TRUE;
}
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 1526 of file class.assQuestion.php.

References $id, and $result.

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

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

Referenced by saveToDb().

{
return false;
}

+ Here is the caller graph for this function:

static assQuestion::isCoreQuestionType (   $questionType)
static

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

References getGuiClassNameByQuestionType().

{
$guiClassName = self::getGuiClassNameByQuestionType($questionType);
return file_exists("Modules/TestQuestionPool/classes/class.{$guiClassName}.php");
}

+ Here is the call 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
Deprecated:
use ilUtil::isHTML() instead

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

References $result, 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:

static assQuestion::isObligationPossible (   $questionId)
static

returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration

method can be overwritten in derived classes, but be aware of also overwrite the method assQuestion::isAnswered()

Parameters
integer$questionId
Returns
boolean $obligationPossible

Reimplemented in assSingleChoice, assFileUpload, and assTextQuestion.

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

{
return false;
}
assQuestion::isValidAdditionalContentEditingMode (   $additionalContentEditingMode)

returns the fact wether the passed additional content mode is valid or not

public

Parameters
string$additionalContentEditingMode
Returns
boolean $isValidAdditionalContentEditingMode

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

References getValidAdditionalContentEditingModes().

{
if( in_array($additionalContentEditingMode, $this->getValidAdditionalContentEditingModes()) )
{
return true;
}
return false;
}

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

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

Loads the question from the database.

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

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

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

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

{
global $ilDB;
$result = $ilDB->queryF(
"SELECT external_id FROM qpl_questions WHERE question_id = %s",
array("integer"),
array($question_id)
);
if($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
$this->external_id = $data['external_id'];
}
$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 1293 of file class.assQuestion.php.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::lookupOriginalParentObjId (   $originalQuestionId)
static

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

ilDB $ilDB

Parameters
integer$originalQuestionId
Returns
integer $originalQuestionParentObjectId
Deprecated:
: use assQuestion::lookupParentObjId() instead

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

References lookupParentObjId().

Referenced by assMultipleChoice\syncImages(), and syncWithOriginal().

{
return self::lookupParentObjId($originalQuestionId);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static assQuestion::lookupParentObjId (   $questionId)
static

ilDB $ilDB

Parameters
integer$questionId
Returns
integer $parentObjectId

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

References $query, and $res.

Referenced by ilObjTestGUI\copyAndLinkToQuestionpoolObject(), and lookupOriginalParentObjId().

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

+ Here is the caller graph for this function:

assQuestion::moveUploadedMediaFile (   $file,
  $name 
)

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

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

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

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

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

+ Here is the call graph for this function:

assQuestion::notifyQuestionCreated ( )
private

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

References getQuestionChangeListeners().

Referenced by createNewQuestion().

{
foreach($this->getQuestionChangeListeners() as $listener)
{
$listener->notifyQuestionCreated($this);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::notifyQuestionDeleted ( )
private

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

References getQuestionChangeListeners().

Referenced by delete().

{
foreach($this->getQuestionChangeListeners() as $listener)
{
$listener->notifyQuestionDeleted($this);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::notifyQuestionEdited ( )
private

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

References getQuestionChangeListeners().

Referenced by saveToDb().

{
foreach($this->getQuestionChangeListeners() as $listener)
{
$listener->notifyQuestionEdited($this);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::onCopy (   $sourceParentId,
  $sourceQuestionId,
  $targetParentId,
  $targetQuestionId 
)
protected

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

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

References copySuggestedSolutionFiles(), and duplicateQuestionHints().

{
$this->copySuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
// duplicate question feeback
$this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
// duplicate question hints
$this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
}

+ Here is the call graph for this function:

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

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

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

References duplicateQuestionHints(), and duplicateSuggestedSolutionFiles().

{
$this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
// duplicate question feeback
$this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
// duplicate question hints
$this->duplicateQuestionHints($originalQuestionId, $duplicateQuestionId);
}

+ Here is the call graph for this function:

assQuestion::onSyncWithOriginal (   $originalQuestionId,
  $duplicateQuestionId 
)
protected

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

Referenced by syncWithOriginal().

{
// sync question feeback
$this->feedbackOBJ->syncFeedback($originalQuestionId, $duplicateQuestionId);
}

+ Here is the caller graph for this function:

static assQuestion::originalQuestionExists (   $questionId)
static

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

References $query, and $res.

Referenced by ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), and ilObjTestGUI\copyAndLinkToQuestionpoolObject().

{
global $ilDB;
$query = "
SELECT COUNT(dupl.question_id) cnt
FROM qpl_questions dupl
INNER JOIN qpl_questions orig
ON orig.question_id = dupl.original_id
WHERE dupl.question_id = %s
";
$res = $ilDB->queryF($query, array('integer'), array($questionId));
$row = $ilDB->fetchAssoc($res);
return $row['cnt'] > 0;
}

+ Here is the caller 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 1545 of file class.assQuestion.php.

References $result.

Referenced by assOrderingQuestion\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::persistWorkingState (   $active_id,
  $pass = NULL,
  $obligationsEnabled = false 
)
final

persists the working state for current testactive and testpass

public

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

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

References $pass, ilObjTest\_getPass(), calculateResultsFromSolution(), getProcessLocker(), reworkWorkingData(), and saveWorkingData().

{
if( $pass === null )
{
require_once 'Modules/Test/classes/class.ilObjTest.php';
$pass = ilObjTest::_getPass($active_id);
}
$this->getProcessLocker()->requestPersistWorkingStateLock();
$saveStatus = $this->saveWorkingData($active_id, $pass);
$this->calculateResultsFromSolution($active_id, $pass, $obligationsEnabled);
$this->reworkWorkingData($active_id, $pass, $obligationsEnabled);
$this->getProcessLocker()->releasePersistWorkingStateLock();
return $saveStatus;
}

+ Here is the call 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 3131 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 3144 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 351 of file class.assQuestion.php.

References $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::requiresJsSwitch ( )

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

References supportsJavascriptOutput(), and supportsNonJsOutput().

{
return $this->supportsJavascriptOutput() && $this->supportsNonJsOutput();
}

+ Here is the call graph for this function:

assQuestion::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered 
)
abstractprotected

Reworks the allready saved working data if neccessary.

protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

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

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

assQuestion::saveQuestionDataToDb (   $original_id = "")

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

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

Referenced by assOrderingHorizontal\saveToDb(), assFileUpload\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assNumeric\saveToDb(), assTextSubset\saveToDb(), assTextQuestion\saveToDb(), assOrderingQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assMultipleChoice\saveToDb(), assClozeTest\saveToDb(), assJavaApplet\saveToDb(), and assFormulaQuestion\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()),
"external_id" => array("text", $this->getExternalId()),
'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
));
$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()),
"external_id" => array("text", $this->getExternalId())
), array(
"question_id" => array("integer", $this->getId())
));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assQuestion::saveToDb (   $original_id = "")

Saves the question to the database.

Parameters
integer$original_idpublic

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

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

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

Referenced by syncWithOriginal().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Saves the learners input of the question to the database.

public

Parameters
integer$active_idActive id of the user
integer$passTest pass
Returns
boolean $status

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

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

assQuestion::setAdditionalContentEditingMode (   $additinalContentEditingMode)

setter for additional content editing mode for this question

public

Returns
string

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

References $additinalContentEditingMode, and getValidAdditionalContentEditingModes().

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

{
{
require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
throw new ilTestQuestionPoolException('invalid additional content editing mode given: '.$additinalContentEditingMode);
}
$this->additinalContentEditingMode = $additinalContentEditingMode;
}

+ Here is the call graph for this function:

+ Here is the caller 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 485 of file class.assQuestion.php.

References $author.

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

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

+ Here is the caller graph for this function:

assQuestion::setComment (   $comment = "")
assQuestion::setDefaultNrOfTries (   $a_defaultnroftries)

Set Default Nr of Tries.

Parameters
int$a_defaultnroftriesDefault Nr. of Tries

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

{
$this->defaultnroftries = $a_defaultnroftries;
}
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 451 of file class.assQuestion.php.

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

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

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

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

{
$this->export_image_path = (string)$a_path;
}
assQuestion::setExternalId (   $external_id)
Parameters
string$external_id

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

References $external_id.

Referenced by __construct().

{
$this->external_id = $external_id;
}

+ Here is the caller graph for this function:

assQuestion::setNewOriginalId (   $newId)

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

References getId().

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

+ Here is the call graph for this function:

assQuestion::setObjId (   $obj_id = 0)
assQuestion::setObligationsToBeConsidered (   $obligationsToBeConsidered = true)

sets the flag wether obligations are to be considered or not

Parameters
bool$obligationsToBeConsidered

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

References $obligationsToBeConsidered.

{
$this->obligationsToBeConsidered = (bool)$obligationsToBeConsidered;
}
assQuestion::setOutputType (   $outputType = OUTPUT_HTML)

Sets the output type.

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

Reimplemented in assSingleChoice, and assMultipleChoice.

Definition at line 417 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::setPreventRteUsage (   $a_val)

Set prevent rte usage.

Parameters
booleanprevent rte usage

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

{
$this->prevent_rte_usage = $a_val;
}
assQuestion::setProcessLocker (   $processLocker)
Parameters
\ilAssQuestionProcessLocker$processLocker

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

References $processLocker.

{
$this->processLocker = $processLocker;
}
assQuestion::setQuestion (   $question = "")
assQuestion::setSelfAssessmentEditingMode (   $a_selfassessmenteditingmode)

Set Self-Assessment Editing Mode.

Parameters
boolean$a_selfassessmenteditingmodeSelf-Assessment Editing Mode

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

{
$this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
}
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 430 of file class.assQuestion.php.

References $shuffle.

Referenced by __set(), assTextQuestion\loadFromDb(), assSingleChoice\loadFromDb(), and assMultipleChoice\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 2381 of file class.assQuestion.php.

References _resolveInternalLink().

Referenced by assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), and assFormulaQuestion\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 393 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, assOrderingQuestion, and assOrderingHorizontal.

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

Referenced by requiresJsSwitch().

{
return FALSE;
}

+ Here is the caller graph for this function:

assQuestion::supportsNonJsOutput ( )

Reimplemented in assOrderingQuestion, and assOrderingHorizontal.

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

Referenced by requiresJsSwitch().

{
return true;
}

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

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

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

+ Here is the call graph for this function:

assQuestion::syncWithOriginal ( )

Reimplemented in assImagemapQuestion, assMultipleChoice, and assSingleChoice.

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

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

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

+ Here is the call graph for this function:

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

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

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

References getQuestionType().

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

+ Here is the call graph for this function:

Field Documentation

assQuestion::$additinalContentEditingMode = null
private
assQuestion::$arrData
private

Associative array to store properties.

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

assQuestion::$defaultnroftries = false

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

Referenced by getDefaultNrOfTries().

assQuestion::$est_working_time
protected

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

Referenced by getEstimatedWorkingTime().

assQuestion::$export_image_path
private

(Web) Path to images

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

Referenced by getImagePathWeb().

assQuestion::$external_id = ''
protected

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

Referenced by getExternalId(), and setExternalId().

assQuestion::$feedbackOBJ = null

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

assQuestion::$ilias
protected

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

Referenced by __construct(), and __get().

assQuestion::$lng
protected
assQuestion::$nr_of_tries
private

Number of tries.

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

Referenced by getNrOfTries().

assQuestion::$obj_id
protected

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

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

assQuestion::$obligationsToBeConsidered = false
private
assQuestion::$original_id
protected
assQuestion::$outputType
protected

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

Referenced by getOutputType(), and setOutputType().

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

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

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

assQuestion::$prevent_rte_usage = false

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

Referenced by getPreventRteUsage().

assQuestion::$processLocker
protected
assQuestion::$questionChangeListeners = array()
protected

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

Referenced by getQuestionChangeListeners().

assQuestion::$selfassessmenteditingmode = false

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

Referenced by getSelfAssessmentEditingMode().

assQuestion::$suggested_solutions
protected

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

Referenced by getSuggestedSolutions().

assQuestion::$title
protected

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

Referenced by assOrderingHorizontal\__construct(), assFlashQuestion\__construct(), assErrorText\__construct(), assFormulaQuestion\__construct(), assFileUpload\__construct(), assNumeric\__construct(), assImagemapQuestion\__construct(), assTextSubset\__construct(), assTextQuestion\__construct(), assOrderingQuestion\__construct(), assSingleChoice\__construct(), assMatchingQuestion\__construct(), assClozeTest\__construct(), assMultipleChoice\__construct(), assJavaApplet\__construct(), __construct(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assNumeric\copyObject(), assImagemapQuestion\copyObject(), assTextQuestion\copyObject(), assFlashQuestion\copyObject(), assOrderingQuestion\copyObject(), assErrorText\copyObject(), assTextSubset\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assMatchingQuestion\copyObject(), assJavaApplet\copyObject(), assFormulaQuestion\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assImagemapQuestion\duplicate(), assFlashQuestion\duplicate(), assTextQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assJavaApplet\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), getSuggestedSolutionTitle(), getTitle(), questionTitleExists(), and setTitle().

assQuestion::$tpl
protected

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

Referenced by __construct(), and __get().

const assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'

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