ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules 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 More...
 
 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. More...
 
 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. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
_getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 _getReachedPoints ($active_id, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question. More...
 
 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. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=NULL)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=NULL, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=NULL, $obligationsEnabled=false)
 persists the working state for current testactive and testpass More...
 
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
getSolutionValues ($active_id, $pass=NULL)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTitle ($a_q_id)
 Returns the title of a question. More...
 
 _getQuestionText ($a_q_id)
 Returns question text. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 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. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _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. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=NULL)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 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. More...
 
 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. More...
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 _needsManualScoring ($question_id)
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 _questionExistsInTest ($question_id, $test_id)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 setObligationsToBeConsidered ($obligationsToBeConsidered=true)
 sets the flag wether obligations are to be considered or not More...
 
 areObligationsToBeConsidered ()
 gets the flag wether obligations are to be considered or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 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. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
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. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
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. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static lookupParentObjId ($questionId)
 ilDB $ilDB More...
 
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) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 

Data Fields

const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $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. More...
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 onSyncWithOriginal ($originalQuestionId, $duplicateQuestionId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 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 More...
 

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. More...
 
 $arrData
 Associative array to store properties. More...
 
 $export_image_path
 (Web) Path to images More...
 
 $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$

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

249  {
250  global $ilias;
251  global $lng;
252  global $tpl;
253 
254  $this->ilias =& $ilias;
255  $this->lng =& $lng;
256  $this->tpl =& $tpl;
257 
258  $this->original_id = null;
259  $this->title = $title;
260  $this->comment = $comment;
261  $this->page = null;
262  $this->author = $author;
263  $this->setQuestion($question);
264  if (!$this->author)
265  {
266  $this->author = $this->ilias->account->fullname;
267  }
268  $this->owner = $owner;
269  if ($this->owner <= 0)
270  {
271  $this->owner = $this->ilias->account->id;
272  }
273  $this->id = -1;
274  $this->test_id = -1;
275  $this->suggested_solutions = array();
276  $this->shuffle = 1;
277  $this->nr_of_tries = "";
278  $this->setEstimatedWorkingTime(0,1,0);
279  $this->outputType = OUTPUT_HTML;
280  $this->arrData = array();
281  $this->setExternalId('');
282  }
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question.
redirection script todo: (a better solution should control the processing via a xml file) ...
setExternalId($external_id)
setQuestion($question="")
Sets the question string of the question object.
const OUTPUT_HTML
+ Here is the call graph for this function:

Member Function Documentation

◆ __get()

assQuestion::__get (   $value)

Object getter.

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

3711  {
3712  switch ($value)
3713  {
3714  case "id":
3715  return $this->getId();
3716  break;
3717  case "title":
3718  return $this->getTitle();
3719  break;
3720  case "comment":
3721  return $this->getComment();
3722  break;
3723  case "owner":
3724  return $this->getOwner();
3725  break;
3726  case "author":
3727  return $this->getAuthor();
3728  break;
3729  case "question":
3730  return $this->getQuestion();
3731  break;
3732  case "points":
3733  return $this->getPoints();
3734  break;
3735  case "est_working_time":
3736  return $this->getEstimatedWorkingTime();
3737  break;
3738  case "shuffle":
3739  return $this->getShuffle();
3740  break;
3741  case "test_id":
3742  return $this->getTestId();
3743  break;
3744  case "obj_id":
3745  return $this->getObjId();
3746  break;
3747  case "ilias":
3748  return $this->ilias;
3749  break;
3750  case "tpl":
3751  return $this->tpl;
3752  break;
3753  case "page":
3754  return $this->page;
3755  break;
3756  case "outputType":
3757  return $this->getOutputType();
3758  break;
3759  case "suggested_solutions":
3760  return $this->getSuggestedSolutions();
3761  break;
3762  case "original_id":
3763  return $this->getOriginalId();
3764  break;
3765  default:
3766  if (array_key_exists($value, $this->arrData))
3767  {
3768  return $this->arrData[$value];
3769  }
3770  else
3771  {
3772  return null;
3773  }
3774  break;
3775  }
3776  }
getId()
Gets the id of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getObjId()
Get the object id of the container object.
getShuffle()
Gets the shuffle flag.
getTestId()
Gets the test id of the assQuestion object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestion()
Gets the question string of the question object.
getComment()
Gets the comment string of the assQuestion object.
getOwner()
Gets the creator/owner ID of the assQuestion object.
getEstimatedWorkingTime()
Gets the estimated working time of a question.
getTitle()
Gets the title string of the assQuestion object.
getOutputType()
Gets the output type.
getSuggestedSolutions()
Return the suggested solutions.
+ Here is the call graph for this function:

◆ __set()

assQuestion::__set (   $key,
  $value 
)

Object setter.

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

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

3782  {
3783  switch ($key)
3784  {
3785  case "id":
3786  $this->setId($value);
3787  break;
3788  case "title":
3789  $this->setTitle($value);
3790  break;
3791  case "comment":
3792  $this->setComment($value);
3793  break;
3794  case "owner":
3795  $this->setOwner($value);
3796  break;
3797  case "author":
3798  $this->setAuthor($value);
3799  break;
3800  case "question":
3801  $this->setQuestion($value);
3802  break;
3803  case "points":
3804  $this->setPoints($value);
3805  break;
3806  case "est_working_time":
3807  if (is_array($value))
3808  {
3809  $this->setEstimatedWorkingTime($value["h"], $value["m"], $value["s"]);
3810  }
3811  break;
3812  case "shuffle":
3813  $this->setShuffle($value);
3814  break;
3815  case "test_id":
3816  $this->setTestId($value);
3817  break;
3818  case "obj_id":
3819  $this->setObjId($value);
3820  break;
3821  case "outputType":
3822  $this->setOutputType($value);
3823  break;
3824  case "original_id":
3825  $this->setOriginalId($value);
3826  break;
3827  case "page":
3828  $this->page =& $value;
3829  break;
3830  default:
3831  $this->arrData[$key] = $value;
3832  break;
3833  }
3834  }
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question.
setShuffle($shuffle=true)
Sets the shuffle flag.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setOutputType($outputType=OUTPUT_HTML)
Sets the output type.
setPoints($a_points)
Sets the maximum available points for the question.
setQuestion($question="")
Sets the question string of the question object.
setTestId($id=-1)
Sets the test id of the assQuestion object.
setOriginalId($original_id)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ _areAnswered()

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

3092  {
3093  global $ilDB;
3094 
3095  $res = $ilDB->queryF("SELECT DISTINCT(question_fi) FROM tst_test_result JOIN tst_active ".
3096  "ON (active_id = active_fi) ".
3097  "WHERE " . $ilDB->in('question_fi', $a_question_ids, false, 'integer') .
3098  " AND user_fi = %s",
3099  array('integer'),
3100  array($a_user_id)
3101  );
3102  return ($res->numRows() == count($a_question_ids)) ? true : false;
3103  }
+ Here is the caller graph for this function:

◆ _getInternalLinkHref()

assQuestion::_getInternalLinkHref (   $target = "")

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

References $target_id.

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

2665  {
2666  global $ilDB;
2667  $linktypes = array(
2668  "lm" => "LearningModule",
2669  "pg" => "PageObject",
2670  "st" => "StructureObject",
2671  "git" => "GlossaryItem",
2672  "mob" => "MediaObject"
2673  );
2674  $href = "";
2675  if (preg_match("/il__(\w+)_(\d+)/", $target, $matches))
2676  {
2677  $type = $matches[1];
2678  $target_id = $matches[2];
2679  include_once "./Services/Utilities/classes/class.ilUtil.php";
2680  switch($linktypes[$matches[1]])
2681  {
2682  case "LearningModule":
2683  $href = "./goto.php?target=" . $type . "_" . $target_id;
2684  break;
2685  case "PageObject":
2686  case "StructureObject":
2687  $href = "./goto.php?target=" . $type . "_" . $target_id;
2688  break;
2689  case "GlossaryItem":
2690  $href = "./goto.php?target=" . $type . "_" . $target_id;
2691  break;
2692  case "MediaObject":
2693  $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=".$_GET["ref_id"]."&mob_id=".$target_id;
2694  break;
2695  }
2696  }
2697  return $href;
2698  }
$target_id
Definition: goto.php:88
+ Here is the caller graph for this function:

◆ _getMaximumPoints()

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 ilTestScoringByQuestionsGUI\__construct(), _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), ilTestScoringGUI\buildManScoringParticipantForm(), assFileUpload\handleSubmission(), ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter(), and ilTestScoringGUI\saveManScoringParticipantScreen().

700  {
701  global $ilDB;
702 
703  $points = 0;
704  $result = $ilDB->queryF("SELECT points FROM qpl_questions WHERE question_id = %s",
705  array('integer'),
706  array($question_id)
707  );
708  if ($result->numRows() == 1)
709  {
710  $row = $ilDB->fetchAssoc($result);
711  $points = $row["points"];
712  }
713  return $points;
714  }
$result
+ Here is the caller graph for this function:

◆ _getOriginalId()

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, and $row.

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

2708  {
2709  global $ilDB;
2710  $result = $ilDB->queryF("SELECT * FROM qpl_questions WHERE question_id = %s",
2711  array('integer'),
2712  array($question_id)
2713  );
2714  if ($result->numRows() > 0)
2715  {
2716  $row = $ilDB->fetchAssoc($result);
2717  if ($row["original_id"] > 0)
2718  {
2719  return $row["original_id"];
2720  }
2721  else
2722  {
2723  return $row["question_id"];
2724  }
2725  }
2726  else
2727  {
2728  return "";
2729  }
2730  }
$result
+ Here is the caller graph for this function:

◆ _getQuestionInfo()

& 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 ilTestScoringByQuestionsGUI\__construct(), ilObjMediaObject\getParentObjectIdForUsage(), and ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter().

723  {
724  global $ilDB;
725 
726  $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",
727  array('integer'),
728  array($question_id)
729  );
730  if ($result->numRows())
731  {
732  return $ilDB->fetchAssoc($result);
733  }
734  else return array();
735  }
$result
+ Here is the caller graph for this function:

◆ _getQuestionText()

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, and $row.

Referenced by ilLMQuestionListTableGUI\fillRow().

1940  {
1941  global $ilDB;
1942  $result = $ilDB->queryF("SELECT question_text FROM qpl_questions WHERE question_id = %s",
1943  array('integer'),
1944  array($a_q_id)
1945  );
1946  if ($result->numRows() == 1)
1947  {
1948  $row = $ilDB->fetchAssoc($result);
1949  return $row["question_text"];
1950  }
1951  else
1952  {
1953  return "";
1954  }
1955  }
$result
+ Here is the caller graph for this function:

◆ _getQuestionTitle()

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 $data, $result, and ilDB\fetchAssoc().

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

2050  {
2051  global $ilDB;
2052 
2053  if ($question_id < 1) return "";
2054 
2055  $result = $ilDB->queryF("SELECT title FROM qpl_questions WHERE qpl_questions.question_id = %s",
2056  array('integer'),
2057  array($question_id)
2058  );
2059  if ($result->numRows() == 1)
2060  {
2061  $data = $ilDB->fetchAssoc($result);
2062  return $data["title"];
2063  }
2064  else
2065  {
2066  return "";
2067  }
2068  }
$result
fetchAssoc($a_set)
Fetch row as associative array from result set.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionType()

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 $data, $result, and ilDB\fetchAssoc().

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

2023  {
2024  global $ilDB;
2025 
2026  if ($question_id < 1) return "";
2027  $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",
2028  array('integer'),
2029  array($question_id)
2030  );
2031  if ($result->numRows() == 1)
2032  {
2033  $data = $ilDB->fetchAssoc($result);
2034  return $data["type_tag"];
2035  }
2036  else
2037  {
2038  return "";
2039  }
2040  }
$result
fetchAssoc($a_set)
Fetch row as associative array from result set.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionTypeName()

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

3612  {
3613  if (file_exists("./Modules/TestQuestionPool/classes/class.".$type_tag.".php"))
3614  {
3615  global $lng;
3616  return $lng->txt($type_tag);
3617  }
3618  else
3619  {
3620  global $ilPluginAdmin;
3621  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
3622  foreach ($pl_names as $pl_name)
3623  {
3624  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
3625  if (strcmp($pl->getQuestionType(), $type_tag) == 0)
3626  {
3627  return $pl->getQuestionTypeTranslation();
3628  }
3629  }
3630  }
3631  return "";
3632  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const IL_COMP_MODULE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getReachedPoints()

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 ilTestScoringByQuestionsGUI\__construct(), ilTestScoringGUI\buildManScoringParticipantForm(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), getReachedPoints(), and ilTestPlayerDynamicQuestionSetGUI\isQuestionAnsweredCorrect().

844  {
845  global $ilDB;
846 
847  $points = 0;
848  if (is_null($pass))
849  {
850  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
851  $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
852  }
853  $result = $ilDB->queryF("SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
854  array('integer','integer','integer'),
855  array($active_id, $question_id, $pass)
856  );
857  if ($result->numRows() == 1)
858  {
859  $row = $ilDB->fetchAssoc($result);
860  $points = $row["points"];
861  }
862  return $points;
863  }
$result
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSolutionMaxPass()

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, and $row.

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

2930  {
2931 /* include_once "./Modules/Test/classes/class.ilObjTest.php";
2932  $pass = ilObjTest::_getPass($active_id);
2933  return $pass;*/
2934 
2935  // the following code was the old solution which added the non answered
2936  // questions of a pass from the answered questions of the previous pass
2937  // with the above solution, only the answered questions of the last pass are counted
2938  global $ilDB;
2939 
2940  $result = $ilDB->queryF("SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
2941  array('integer','integer'),
2942  array($active_id, $question_id)
2943  );
2944  if ($result->numRows() == 1)
2945  {
2946  $row = $ilDB->fetchAssoc($result);
2947  return $row["maxpass"];
2948  }
2949  else
2950  {
2951  return 0;
2952  }
2953  }
$result
+ Here is the caller graph for this function:

◆ _getSuggestedSolution()

& 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.

805  {
806  global $ilDB;
807 
808  $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
809  array('integer','integer'),
810  array($question_id, $subquestion_index)
811  );
812  if ($result->numRows() == 1)
813  {
814  $row = $ilDB->fetchAssoc($result);
815  return array(
816  "internal_link" => $row["internal_link"],
817  "import_id" => $row["import_id"]
818  );
819  }
820  else
821  {
822  return array();
823  }
824  }
$result

◆ _getSuggestedSolutionCount()

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.

744  {
745  global $ilDB;
746 
747  $result = $ilDB->queryF("SELECT suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
748  array('integer'),
749  array($question_id)
750  );
751  return $result->numRows();
752  }
$result

◆ _getSuggestedSolutionOutput()

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

761  {
763  if (!is_object($question)) return "";
764  return $question->getSuggestedSolutionOutput();
765  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getTitle()

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, and $row.

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

1917  {
1918  global $ilDB;
1919  $result = $ilDB->queryF("SELECT title FROM qpl_questions WHERE question_id = %s",
1920  array('integer'),
1921  array($a_q_id)
1922  );
1923  if ($result->numRows() == 1)
1924  {
1925  $row = $ilDB->fetchAssoc($result);
1926  return $row["title"];
1927  }
1928  else
1929  {
1930  return "";
1931  }
1932  }
$result
+ Here is the caller graph for this function:

◆ _getTotalAnswers()

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, and $row.

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

1839  {
1840  global $ilDB;
1841 
1842  // get all question references to the question id
1843  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
1844  array('integer','integer'),
1845  array($a_q_id, $a_q_id)
1846  );
1847  if ($result->numRows() == 0)
1848  {
1849  return 0;
1850  }
1851  $found_id = array();
1852  while ($row = $ilDB->fetchAssoc($result))
1853  {
1854  array_push($found_id, $row["question_id"]);
1855  }
1856 
1857  $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
1858 
1859  return $result->numRows();
1860  }
$result
+ Here is the caller graph for this function:

◆ _getTotalRightAnswers()

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, $row, and _getMaximumPoints().

Referenced by ilObjQuestionPoolGUI\assessmentObject().

1870  {
1871  global $ilDB;
1872  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
1873  array('integer','integer'),
1874  array($a_q_id, $a_q_id)
1875  );
1876  if ($result->numRows() == 0)
1877  {
1878  return 0;
1879  }
1880  $found_id = array();
1881  while ($row = $ilDB->fetchAssoc($result))
1882  {
1883  array_push($found_id, $row["question_id"]);
1884  }
1885  $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
1886  $answers = array();
1887  while ($row = $ilDB->fetchAssoc($result))
1888  {
1889  $reached = $row["points"];
1890  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1891  $max = assQuestion::_getMaximumPoints($row["question_fi"]);
1892  array_push($answers, array("reached" => $reached, "max" => $max));
1893  }
1894  $max = 0.0;
1895  $reached = 0.0;
1896  foreach ($answers as $key => $value)
1897  {
1898  $max += $value["max"];
1899  $reached += $value["reached"];
1900  }
1901  if ($max > 0)
1902  {
1903  return $reached / $max;
1904  }
1905  else
1906  {
1907  return 0;
1908  }
1909  }
$result
_getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _includeClass()

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.

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

3524  {
3525  if( self::isCoreQuestionType($question_type) )
3526  {
3527  self::includeCoreClass($question_type, $gui);
3528  }
3529  else
3530  {
3531  self::includePluginClass($question_type, $gui);
3532  }
3533  }
+ Here is the caller graph for this function:

◆ _instanciateQuestion()

◆ _instanciateQuestionGUI()

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.

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

3644  {
3645  return self::instantiateQuestionGUI($question_id);
3646  }
+ Here is the caller graph for this function:

◆ _instantiateQuestion()

static assQuestion::_instantiateQuestion (   $question_id)
static

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

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

Referenced by ilAssIncompleteQuestionPurger\purgeQuestionIds().

2863  {
2864  global $ilCtrl, $ilDB, $lng;
2865 
2866  if (strcmp($question_id, "") != 0)
2867  {
2868  $question_type = assQuestion::_getQuestionType($question_id);
2869  if (!strlen($question_type)) return null;
2870  assQuestion::_includeClass($question_type);
2871  $objectClassname = self::getObjectClassNameByQuestionType($question_type);
2872  $question = new $objectClassname();
2873  $question->loadFromDb($question_id);
2874 
2875  $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
2876  $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
2877 
2878  return $question;
2879  }
2880  }
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isUsedInRandomTest()

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 $pass, $result, and calculateReachedPoints().

Referenced by ilObjQuestionPool\getDeleteableQuestionDetails().

2996  {
2997  global $ilDB;
2998 
2999  if ($question_id < 1) return 0;
3000  $result = $ilDB->queryF("SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s",
3001  array('integer'),
3002  array($question_id)
3003  );
3004  return $result->numRows();
3005  }
$result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isWorkedThrough()

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 $pass, $points, $result, and _getSolutionMaxPass().

Referenced by ilObjTest\getAnsweredQuestionCount().

3061  {
3062  global $ilDB;
3063 
3064  $points = 0;
3065  if (is_null($pass))
3066  {
3067  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3068  $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3069  }
3070  $result = $ilDB->queryF("SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3071  array('integer','integer','integer'),
3072  array($active_id, $question_id, $pass)
3073  );
3074  if ($result->numRows())
3075  {
3076  return TRUE;
3077  }
3078  else
3079  {
3080  return FALSE;
3081  }
3082  }
$result
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isWriteable()

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, $row, and ilObjQuestionPool\_isWriteable().

Referenced by ilAssQuestionFeedbackEditingGUI\isSyncAfterSaveRequired(), ilAssQuestionHintsGUI\performDeleteCmd(), assQuestionGUI\save(), assQuestionGUI\saveEdit(), ilAssQuestionHintGUI\saveFormCmd(), ilAssQuestionHintsGUI\saveListOrderCmd(), assQuestionGUI\saveReturn(), assFormulaQuestionGUI\saveReturnFQ(), and assQuestionGUI\suggestedsolution().

2964  {
2965  global $ilDB;
2966 
2967  if (($question_id < 1) || ($user_id < 1))
2968  {
2969  return false;
2970  }
2971 
2972  $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
2973  array('integer'),
2974  array($question_id)
2975  );
2976  if ($result->numRows() == 1)
2977  {
2978  $row = $ilDB->fetchAssoc($result);
2979  $qpl_object_id = $row["obj_fi"];
2980  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2981  return ilObjQuestionPool::_isWriteable($qpl_object_id, $user_id);
2982  }
2983  else
2984  {
2985  return false;
2986  }
2987  }
$result
_isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _logAction()

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

1316  {
1317  global $ilUser;
1318 
1319  $original_id = "";
1320  if (strcmp($question_id, "") != 0)
1321  {
1322  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1323  $original_id = assQuestion::_getOriginalId($question_id);
1324  }
1325  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1326  include_once "./Modules/Test/classes/class.ilObjTest.php";
1327  ilObjAssessmentFolder::_addLog($ilUser->id, ilObjTest::_getObjectIDFromActiveID($active_id), $logtext, $question_id, $original_id);
1328  }
static _getOriginalId($question_id)
Returns the original id of a question.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _needsManualScoring()

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

3477  {
3478  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
3480  $questiontype = assQuestion::_getQuestionType($question_id);
3481  if (in_array($questiontype, $scoring))
3482  {
3483  return TRUE;
3484  }
3485  else
3486  {
3487  return FALSE;
3488  }
3489  }
_getManualScoringTypes()
Retrieve the manual scoring settings as type strings.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _questionExists()

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.

2798  {
2799  global $ilDB;
2800 
2801  if ($question_id < 1)
2802  {
2803  return false;
2804  }
2805 
2806  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE question_id = %s",
2807  array('integer'),
2808  array($question_id)
2809  );
2810  if ($result->numRows() == 1)
2811  {
2812  return true;
2813  }
2814  else
2815  {
2816  return false;
2817  }
2818  }
$result

◆ _questionExistsInPool()

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

2828  {
2829  global $ilDB;
2830 
2831  if ($question_id < 1)
2832  {
2833  return false;
2834  }
2835 
2836  $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'",
2837  array('integer'),
2838  array($question_id)
2839  );
2840  if ($result->numRows() == 1)
2841  {
2842  return true;
2843  }
2844  else
2845  {
2846  return false;
2847  }
2848  }
$result
+ Here is the caller graph for this function:

◆ _questionExistsInTest()

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

3852  {
3853  global $ilDB;
3854 
3855  if ($question_id < 1)
3856  {
3857  return false;
3858  }
3859 
3860  $result = $ilDB->queryF("SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
3861  array('integer', 'integer'),
3862  array($question_id, $test_id)
3863  );
3864  if ($result->numRows() == 1)
3865  {
3866  return true;
3867  }
3868  else
3869  {
3870  return false;
3871  }
3872  }
$result
+ Here is the caller graph for this function:

◆ _resolveInternalLink()

assQuestion::_resolveInternalLink (   $internal_link)

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

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

Referenced by _resolveIntLinks(), and setSuggestedSolution().

2577  {
2578  if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
2579  {
2580  include_once "./Services/COPage/classes/class.ilInternalLink.php";
2581  include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
2582  include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
2583  switch ($matches[2])
2584  {
2585  case "lm":
2586  $resolved_link = ilLMObject::_getIdForImportId($internal_link);
2587  break;
2588  case "pg":
2589  $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
2590  break;
2591  case "st":
2592  $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
2593  break;
2594  case "git":
2595  $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
2596  break;
2597  case "mob":
2598  $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
2599  break;
2600  }
2601  if (strcmp($resolved_link, "") == 0)
2602  {
2603  $resolved_link = $internal_link;
2604  }
2605  }
2606  else
2607  {
2608  $resolved_link = $internal_link;
2609  }
2610  return $resolved_link;
2611  }
_getIdForImportId($a_import_id)
get current object id for import id (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resolveIntLinks()

assQuestion::_resolveIntLinks (   $question_id)

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

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

Referenced by ilContObjParser\processPagesToParse().

2614  {
2615  global $ilDB;
2616  $resolvedlinks = 0;
2617  $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2618  array('integer'),
2619  array($question_id)
2620  );
2621  if ($result->numRows())
2622  {
2623  while ($row = $ilDB->fetchAssoc($result))
2624  {
2625  $internal_link = $row["internal_link"];
2626  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2627  $resolved_link = assQuestion::_resolveInternalLink($internal_link);
2628  if (strcmp($internal_link, $resolved_link) != 0)
2629  {
2630  // internal link was resolved successfully
2631  $affectedRows = $ilDB->manipulateF("UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
2632  array('text','integer'),
2633  array($resolved_link, $row["suggested_solution_id"])
2634  );
2635  $resolvedlinks++;
2636  }
2637  }
2638  }
2639  if ($resolvedlinks)
2640  {
2641  // there are resolved links -> reenter theses links to the database
2642 
2643  // delete all internal links from the database
2644  include_once "./Services/COPage/classes/class.ilInternalLink.php";
2645  ilInternalLink::_deleteAllLinksOfSource("qst", $question_id);
2646 
2647  $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2648  array('integer'),
2649  array($question_id)
2650  );
2651  if ($result->numRows())
2652  {
2653  while ($row = $ilDB->fetchAssoc($result))
2654  {
2655  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches))
2656  {
2657  ilInternalLink::_saveLink("qst", $question_id, $matches[2], $matches[3], $matches[1]);
2658  }
2659  }
2660  }
2661  }
2662  }
$result
_resolveInternalLink($internal_link)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _setReachedPoints()

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, $pass, $points, $result, $row, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTestAccess\_getParticipantData(), _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), _logAction(), and ilCourseObjectiveResult\_updateObjectiveResult().

Referenced by ilTestScoringByQuestionsGUI\__construct(), assFileUpload\handleSubmission(), ilTestScoring\recalculatePass(), and ilTestScoringGUI\saveManScoringParticipantScreen().

3235  {
3236  global $ilDB;
3237 
3238  if ($points <= $maxpoints)
3239  {
3240  if (is_null($pass))
3241  {
3242  $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3243  }
3244 
3245  // retrieve the already given points
3246  $old_points = 0;
3247  $result = $ilDB->queryF("SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3248  array('integer','integer','integer'),
3249  array($active_id, $question_id, $pass)
3250  );
3251  $manual = ($manualscoring) ? 1 : 0;
3252  $rowsnum = $result->numRows();
3253  if($rowsnum)
3254  {
3255  $row = $ilDB->fetchAssoc($result);
3256  $old_points = $row["points"];
3257  if($old_points != $points)
3258  {
3259  $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",
3260  array('float', 'integer', 'integer', 'integer', 'integer', 'integer'),
3261  array($points, $manual, time(), $active_id, $question_id, $pass)
3262  );
3263  }
3264  }
3265  else
3266  {
3267  $next_id = $ilDB->nextId('tst_test_result');
3268  $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)",
3269  array('integer', 'integer','integer', 'float', 'integer', 'integer','integer'),
3270  array($next_id, $active_id, $question_id, $points, $pass, $manual, time())
3271  );
3272  }
3273 
3274  if($old_points != $points || !$rowsnum)
3275  {
3276  assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
3277  // finally update objective result
3278  include_once "./Modules/Test/classes/class.ilObjTest.php";
3279  include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
3281 
3282  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3284  {
3285  global $lng, $ilUser;
3286  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3287  $username = ilObjTestAccess::_getParticipantData($active_id);
3288  assQuestion::_logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
3289  }
3290  }
3291 
3292  return TRUE;
3293  }
3294  else
3295  {
3296  return FALSE;
3297  }
3298  }
static _getUserIdFromActiveId($active_id)
$result
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
_logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
_getParticipantData($active_id)
Retrieves a participant name from active id.
_getLogLanguage()
retrieve the log language for assessment logging
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateTestResultCache()

assQuestion::_updateTestResultCache (   $active_id,
ilAssQuestionProcessLocker  $processLocker = null 
)

Move this to a proper place.

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

References $data, $pass, $processLocker, $query, $result, $row, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), ilObjTest\_getResultPass(), ilObjTest\_getWorkingTimeOfParticipantForPass(), ilObjTest\buildExamId(), and getProcessLocker().

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

1070  {
1071  global $ilDB;
1072 
1073  include_once "./Modules/Test/classes/class.ilObjTest.php";
1074  include_once "./Modules/Test/classes/class.assMarkSchema.php";
1075 
1076  $pass = ilObjTest::_getResultPass($active_id);
1077 
1078  $query = "
1079  SELECT tst_pass_result.*
1080  FROM tst_pass_result
1081  WHERE active_fi = %s
1082  AND pass = %s
1083  ";
1084 
1085  $result = $ilDB->queryF(
1086  $query, array('integer','integer'), array($active_id, $pass)
1087  );
1088 
1089  $row = $ilDB->fetchAssoc($result);
1090 
1091  $max = $row['maxpoints'];
1092  $reached = $row['points'];
1093 
1094  $obligationsAnswered = (int)$row['obligations_answered'];
1095 
1096  include_once "./Modules/Test/classes/class.assMarkSchema.php";
1097 
1098  $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
1099 
1100  $mark = ASS_MarkSchema::_getMatchingMarkFromActiveId($active_id, $percentage);
1101 
1102  $isPassed = ( $mark["passed"] ? 1 : 0 );
1103  $isFailed = ( !$mark["passed"] ? 1 : 0 );
1104 
1105  if( is_object($processLocker) )
1106  {
1107  $processLocker->requestUserTestResultUpdateLock();
1108  }
1109 
1110  $query = "
1111  DELETE FROM tst_result_cache
1112  WHERE active_fi = %s
1113  ";
1114 
1115  $affectedRows = $ilDB->manipulateF(
1116  $query, array('integer'), array($active_id)
1117  );
1118 
1119  $ilDB->insert('tst_result_cache', array(
1120  'active_fi'=> array('integer', $active_id),
1121  'pass'=> array('integer', strlen($pass) ? $pass : 0),
1122  'max_points'=> array('float', strlen($max) ? $max : 0),
1123  'reached_points'=> array('float', strlen($reached) ? $reached : 0),
1124  'mark_short'=> array('text', strlen($mark["short_name"]) ? $mark["short_name"] : " "),
1125  'mark_official'=> array('text', strlen($mark["official_name"]) ? $mark["official_name"] : " "),
1126  'passed'=> array('integer', $isPassed),
1127  'failed'=> array('integer', $isFailed),
1128  'tstamp'=> array('integer', time()),
1129  'hint_count'=> array('integer', $row['hint_count']),
1130  'hint_points'=> array('float', $row['hint_points']),
1131  'obligations_answered' => array('integer', $obligationsAnswered)
1132  ));
1133 
1134  if( is_object($processLocker) )
1135  {
1136  $processLocker->releaseUserTestResultUpdateLock();
1137  }
1138  }
$result
_getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQTIMaterial()

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

3177  {
3178  include_once "./Services/RTE/classes/class.ilRTE.php";
3179  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3180 
3181  $a_xml_writer->xmlStartTag("material");
3182  $attrs = array(
3183  "texttype" => "text/plain"
3184  );
3185  if ($this->isHTML($a_material))
3186  {
3187  $attrs["texttype"] = "text/xhtml";
3188  }
3189  $a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
3190  if ($add_mobs)
3191  {
3192  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
3193  foreach ($mobs as $mob)
3194  {
3195  $moblabel = "il_" . IL_INST_ID . "_mob_" . $mob;
3196  if (strpos($a_material, "mm_$mob") !== FALSE)
3197  {
3198  if (ilObjMediaObject::_exists($mob))
3199  {
3200  $mob_obj =& new ilObjMediaObject($mob);
3201  $imgattrs = array(
3202  "label" => $moblabel,
3203  "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
3204  );
3205  }
3206  $a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
3207  }
3208  }
3209  }
3210  if ($close_material_tag) $a_xml_writer->xmlEndTag("material");
3211  }
getId()
Gets the id of the assQuestion object.
isHTML($a_text)
Checks if a given string contains HTML or not.
$mobs
static _exists($a_id)
checks wether a lm content object with specified id exists or not
Class ilObjMediaObject.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
+ Here is the call graph for this function:

◆ addQuestionChangeListener()

assQuestion::addQuestionChangeListener ( ilQuestionChangeListener  $listener)
Parameters
ilQuestionChangeListener$listener

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

Referenced by ilObjQuestionPool\addQuestionChangeListeners().

4190  {
4191  $this->questionChangeListeners[] = $listener;
4192  }
+ Here is the caller graph for this function:

◆ adjustReachedPointsByScoringOptions()

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

3031  {
3032  include_once "./Modules/Test/classes/class.ilObjTest.php";
3033  $count_system = ilObjTest::_getCountSystem($active_id);
3034  if ($count_system == 1)
3035  {
3036  if (abs($this->getMaximumPoints() - $points) > 0.0000000001)
3037  {
3038  $points = 0;
3039  }
3040  }
3041  $score_cutting = ilObjTest::_getScoreCutting($active_id);
3042  if ($score_cutting == 0)
3043  {
3044  if ($points < 0)
3045  {
3046  $points = 0;
3047  }
3048  }
3049  return $points;
3050  }
_getCountSystem($active_id)
Gets the count system for the calculation of points.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
_getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ areObligationsToBeConsidered()

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.

4065  {
4066  return (bool)$this->obligationsToBeConsidered;
4067  }

◆ calculateReachedPoints()

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 !!)

Referenced by _isUsedInRandomTest(), calculateResultsFromSolution(), getAdjustedReachedPoints(), and assNumeric\getMaximumPoints().

+ Here is the caller graph for this function:

◆ calculateResultsFromSolution()

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

932  {
933  global $ilDB, $ilUser;
934 
935  if( is_null($pass) )
936  {
937  include_once "./Modules/Test/classes/class.ilObjTest.php";
938  $pass = ilObjTest::_getPass($active_id);
939  }
940 
941  // determine reached points for submitted solution
942  $reached_points = $this->calculateReachedPoints($active_id, $pass);
943 
944  // deduct points for requested hints from reached points
945  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
946  $requestsStatisticData = ilAssQuestionHintTracking::getRequestStatisticDataByQuestionAndTestpass($this->getId(), $active_id, $pass);
947  $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
948 
949  // adjust reached points regarding to tests scoring options
950  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
951 
952  if( $obligationsEnabled && ilObjTest::isQuestionObligatory($this->getId()) )
953  {
954  $isAnswered = $this->isAnswered($active_id, $pass);
955  }
956  else
957  {
958  $isAnswered = true;
959  }
960 
961  if( is_null($reached_points) ) $reached_points = 0;
962 
963  $this->getProcessLocker()->requestUserQuestionResultUpdateLock();
964 
965  $query = "
966  DELETE FROM tst_test_result
967 
968  WHERE active_fi = %s
969  AND question_fi = %s
970  AND pass = %s
971  ";
972 
973  $affectedRows = $ilDB->manipulateF(
974  $query, array("integer", "integer", "integer"), array($active_id, $this->getId(), $pass)
975  );
976 
977  $next_id = $ilDB->nextId("tst_test_result");
978 
979  $ilDB->insert('tst_test_result', array(
980  'test_result_id' => array('integer', $next_id),
981  'active_fi' => array('integer', $active_id),
982  'question_fi' => array('integer', $this->getId()),
983  'pass' => array('integer', $pass),
984  'points' => array('float', $reached_points),
985  'tstamp' => array('integer', time()),
986  'hint_count' => array('integer', $requestsStatisticData->getRequestsCount()),
987  'hint_points' => array('float', $requestsStatisticData->getRequestsPoints()),
988  'answered' => array('integer', $isAnswered)
989  ));
990 
991  $this->getProcessLocker()->releaseUserQuestionResultUpdateLock();
992 
993  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
994 
996  {
997  $this->logAction(
998  sprintf(
999  $this->lng->txtlng(
1000  "assessment", "log_user_answered_question", ilObjAssessmentFolder::_getLogLanguage()
1001  ),
1002  $reached_points
1003  ),
1004  $active_id,
1005  $this->getId()
1006  );
1007  }
1008 
1009  // update test pass results
1010  $this->_updateTestPassResults($active_id, $pass, $obligationsEnabled, $this->getProcessLocker());
1011 
1012  // Update objective status
1013  include_once 'Modules/Course/classes/class.ilCourseObjectiveResult.php';
1014  ilCourseObjectiveResult::_updateObjectiveResult($ilUser->getId(),$active_id,$this->getId());
1015  }
getId()
Gets the id of the assQuestion object.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
adjustReachedPointsByScoringOptions($points, $active_id, $pass=NULL)
Adjust the given reached points by checks for all special scoring options in the test container...
isAnswered($active_id, $pass=null)
returns boolean wether the question is answered during test pass or not
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
static getRequestStatisticDataByQuestionAndTestpass($questionId, $activeId, $pass)
Returns a question hint request statistic data container containing the statistics for all requests r...
_getLogLanguage()
retrieve the log language for assessment logging
global $ilUser
Definition: imgupload.php:15
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupMediaObjectUsage()

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 copySuggestedSolutionFiles(), and saveToDb().

3422  {
3423  $combinedtext = $this->getRTETextWithMediaObjects();
3424  include_once("./Services/RTE/classes/class.ilRTE.php");
3425  ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
3426  }
getId()
Gets the id of the assQuestion object.
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table ...
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyPageOfQuestion()

assQuestion::copyPageOfQuestion (   $a_q_id)

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

References $page.

Referenced by syncWithOriginal().

1996  {
1997  if ($a_q_id > 0)
1998  {
1999  include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2000  $page = new ilAssQuestionPage($a_q_id);
2001 
2002  $xml = str_replace("il__qst_".$a_q_id, "il__qst_".$this->id, $page->getXMLContent());
2003  $this->page->setXMLContent($xml);
2004  $this->page->updateFromXML();
2005  }
2006  }
Question page object.
+ Here is the caller graph for this function:

◆ copySuggestedSolutionFiles()

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

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

References $filename, $id, $ilLog, $original_id, ilInternalLink\_deleteAllLinksOfSource(), ilRTE\_replaceMediaObjectImageSrc(), ilInternalLink\_saveLink(), cleanupMediaObjectUsage(), getId(), getSuggestedSolutionPath(), ilUtil\makeDirParents(), and syncSuggestedSolutionFiles().

Referenced by onCopy().

2464  {
2465  global $ilLog;
2466 
2467  foreach ($this->suggested_solutions as $index => $solution)
2468  {
2469  if (strcmp($solution["type"], "file") == 0)
2470  {
2471  $filepath = $this->getSuggestedSolutionPath();
2472  $filepath_original = str_replace("/$this->obj_id/$this->id/solution", "/$source_questionpool_id/$source_question_id/solution", $filepath);
2473  if (!file_exists($filepath))
2474  {
2475  ilUtil::makeDirParents($filepath);
2476  }
2477  $filename = $solution["value"]["name"];
2478  if (strlen($filename))
2479  {
2480  if (!copy($filepath_original . $filename, $filepath . $filename))
2481  {
2482  $ilLog->write("File could not be copied!!!!", $ilLog->ERROR);
2483  $ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
2484  }
2485  }
2486  }
2487  }
2488  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyXHTMLMediaObjectsOfQuestion()

assQuestion::copyXHTMLMediaObjectsOfQuestion (   $a_q_id)

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

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

1959  {
1960  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1961  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $a_q_id);
1962  foreach ($mobs as $mob)
1963  {
1964  ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
1965  }
1966  }
getId()
Gets the id of the assQuestion object.
$mobs
_saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
+ Here is the call graph for this function:

◆ createNewImageFileName()

assQuestion::createNewImageFileName (   $image_filename)

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

3214  {
3215  $extension = "";
3216  if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $image_filename, $matches))
3217  {
3218  $extension = "." . $matches[1];
3219  }
3220  $image_filename = md5($image_filename) . $extension;
3221  return $image_filename;
3222  }

◆ createNewQuestion()

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

2129  {
2130  global $ilDB, $ilUser;
2131 
2132  $complete = "0";
2133  $estw_time = $this->getEstimatedWorkingTime();
2134  $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2135  $obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($_GET["ref_id"])) ? $_GET["ref_id"] : $_POST["sel_qpl"])) : $this->getObjId();
2136  if ($obj_id > 0)
2137  {
2138  if($a_create_page)
2139  {
2140  $tstamp = 0;
2141  }
2142  else
2143  {
2144  // question pool must not try to purge
2145  $tstamp = time();
2146  }
2147 
2148  $next_id = $ilDB->nextId('qpl_questions');
2149  $affectedRows = $ilDB->insert("qpl_questions", array(
2150  "question_id" => array("integer", $next_id),
2151  "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2152  "obj_fi" => array("integer", $obj_id),
2153  "title" => array("text", NULL),
2154  "description" => array("text", NULL),
2155  "author" => array("text", $this->getAuthor()),
2156  "owner" => array("integer", $ilUser->getId()),
2157  "question_text" => array("clob", NULL),
2158  "points" => array("float", 0),
2159  "nr_of_tries" => array("integer", 1),
2160  "working_time" => array("text", $estw_time),
2161  "complete" => array("text", $complete),
2162  "created" => array("integer", time()),
2163  "original_id" => array("integer", NULL),
2164  "tstamp" => array("integer", $tstamp),
2165  "external_id" => array("text", $this->getExternalId()),
2166  'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2167  ));
2168  $this->setId($next_id);
2169 
2170  if($a_create_page)
2171  {
2172  // create page object of question
2173  $this->createPageObject();
2174  }
2175  }
2176 
2177  $this->notifyQuestionCreated();
2178 
2179  return $this->getId();
2180  }
getId()
Gets the id of the assQuestion object.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
getObjId()
Get the object id of the container object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestionTypeID()
Returns the question type of the question.
static _lookupObjId($a_id)
global $ilUser
Definition: imgupload.php:15
getEstimatedWorkingTime()
Gets the estimated working time of a question.
+ Here is the call graph for this function:

◆ createPageObject()

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

1982  {
1983  $qpl_id = $this->getObjId();
1984 
1985  include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
1986  $this->page = new ilAssQuestionPage(0);
1987  $this->page->setId($this->getId());
1988  $this->page->setParentId($qpl_id);
1989  $this->page->setXMLContent("<PageObject><PageContent>".
1990  "<Question QRef=\"il__qst_".$this->getId()."\"/>".
1991  "</PageContent></PageObject>");
1992  $this->page->create();
1993  }
getId()
Gets the id of the assQuestion object.
Question page object.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRandomSolution()

assQuestion::createRandomSolution (   $test_id,
  $user_id 
)

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

2787  {
2788  }

◆ delete()

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, $row, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), ilUtil\delDir(), deleteAdditionalTableData(), deleteAnswers(), ilAssQuestionHintList\deleteHintsByQuestionIds(), deletePageOfQuestion(), ilAssQuestionHintTracking\deleteRequestsByQuestionIds(), getObjId(), isAdditionalContentEditingModePageObject(), and notifyQuestionDeleted().

1687  {
1688  global $ilDB, $ilLog;
1689 
1690  if ($question_id < 1) return true; // nothing to do
1691 
1692  $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1693  array('integer'),
1694  array($question_id)
1695  );
1696  if ($result->numRows() == 1)
1697  {
1698  $row = $ilDB->fetchAssoc($result);
1699  $obj_id = $row["obj_fi"];
1700  }
1701  else
1702  {
1703  return true; // nothing to do
1704  }
1705  try
1706  {
1707  $this->deletePageOfQuestion($question_id);
1708  }
1709  catch (Exception $e)
1710  {
1711  $ilLog->write("EXCEPTION: Could not delete page of question $question_id: $e");
1712  return false;
1713  }
1714 
1715  $affectedRows = $ilDB->manipulateF("DELETE FROM qpl_questions WHERE question_id = %s",
1716  array('integer'),
1717  array($question_id)
1718  );
1719  if ($affectedRows == 0) return false;
1720 
1721  try
1722  {
1723  $this->deleteAdditionalTableData($question_id);
1724  $this->deleteAnswers($question_id);
1725  $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
1726  $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
1727  }
1728  catch (Exception $e)
1729  {
1730  $ilLog->write("EXCEPTION: Could not delete additional table data of question $question_id: $e");
1731  return false;
1732  }
1733 
1734  try
1735  {
1736  // delete the question in the tst_test_question table (list of test questions)
1737  $affectedRows = $ilDB->manipulateF("DELETE FROM tst_test_question WHERE question_fi = %s",
1738  array('integer'),
1739  array($question_id)
1740  );
1741  }
1742  catch (Exception $e)
1743  {
1744  $ilLog->write("EXCEPTION: Could not delete delete question $question_id from a test: $e");
1745  return false;
1746  }
1747 
1748  try
1749  {
1750  // delete suggested solutions contained in the question
1751  $affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s",
1752  array('integer'),
1753  array($question_id)
1754  );
1755  }
1756  catch (Exception $e)
1757  {
1758  $ilLog->write("EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
1759  return false;
1760  }
1761 
1762  try
1763  {
1764  $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
1765  if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory))
1766  {
1767  include_once "./Services/Utilities/classes/class.ilUtil.php";
1768  ilUtil::delDir($directory);
1769  }
1770  }
1771  catch (Exception $e)
1772  {
1773  $ilLog->write("EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
1774  return false;
1775  }
1776 
1777  try
1778  {
1779  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1780  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
1781  // remaining usages are not in text anymore -> delete them
1782  // and media objects (note: delete method of ilObjMediaObject
1783  // checks whether object is used in another context; if yes,
1784  // the object is not deleted!)
1785  foreach($mobs as $mob)
1786  {
1787  ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
1788  if (ilObjMediaObject::_exists($mob))
1789  {
1790  $mob_obj =& new ilObjMediaObject($mob);
1791  $mob_obj->delete();
1792  }
1793  }
1794  }
1795  catch (Exception $e)
1796  {
1797  $ilLog->write("EXCEPTION: Error deleting the media objects of question $question_id: $e");
1798  return false;
1799  }
1800 
1801  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
1803 
1804  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
1806 
1807  try
1808  {
1809  // update question count of question pool
1810  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1812  }
1813  catch (Exception $e)
1814  {
1815  $ilLog->write("EXCEPTION: Error updating the question pool question count of question pool " . $this->getObjId() . " when deleting question $question_id: $e");
1816  return false;
1817  }
1818 
1819  $this->notifyQuestionDeleted($this);
1820 
1821  return true;
1822  }
deletePageOfQuestion($question_id)
Deletes the page object of a question with a given ID.
$result
deleteAnswers($question_id)
Deletes datasets from answers tables.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
getObjId()
Get the object id of the container object.
_removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
$mobs
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
static _exists($a_id)
checks wether a lm content object with specified id exists or not
static deleteRequestsByQuestionIds($questionIds)
Deletes all hint requests relating to a question included in given question ids.
Class ilObjMediaObject.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ deleteAdditionalTableData()

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

1638  {
1639  global $ilDB;
1640  $additional_table_name = $this->getAdditionalTableName();
1641  if (is_array($additional_table_name))
1642  {
1643  foreach ($additional_table_name as $table)
1644  {
1645  if (strlen($table))
1646  {
1647  $affectedRows = $ilDB->manipulateF("DELETE FROM $table WHERE question_fi = %s",
1648  array('integer'),
1649  array($question_id)
1650  );
1651  }
1652  }
1653  }
1654  else
1655  {
1656  if (strlen($additional_table_name))
1657  {
1658  $affectedRows = $ilDB->manipulateF("DELETE FROM $additional_table_name WHERE question_fi = %s",
1659  array('integer'),
1660  array($question_id)
1661  );
1662  }
1663  }
1664  }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAnswers()

assQuestion::deleteAnswers (   $question_id)

Deletes datasets from answers tables.

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

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

References getAnswerTableName().

Referenced by delete().

1603  {
1604  global $ilDB;
1605  $answer_table_name = $this->getAnswerTableName();
1606  if (is_array($answer_table_name))
1607  {
1608  foreach ($answer_table_name as $table)
1609  {
1610  if (strlen($table))
1611  {
1612  $affectedRows = $ilDB->manipulateF("DELETE FROM $table WHERE question_fi = %s",
1613  array('integer'),
1614  array($question_id)
1615  );
1616  }
1617  }
1618  }
1619  else
1620  {
1621  if (strlen($answer_table_name))
1622  {
1623  $affectedRows = $ilDB->manipulateF("DELETE FROM $answer_table_name WHERE question_fi = %s",
1624  array('integer'),
1625  array($question_id)
1626  );
1627  }
1628  }
1629  }
getAnswerTableName()
Returns the name of the answer table in the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePageOfQuestion()

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

1673  {
1674  include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
1675  $page = new ilAssQuestionPage($question_id);
1676  $page->delete();
1677  return true;
1678  }
Question page object.
+ Here is the caller graph for this function:

◆ deleteSuggestedSolutions()

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

2317  {
2318  global $ilDB;
2319  // delete the links in the qpl_sol_sug table
2320  $affectedRows = $ilDB->manipulateF("DELETE FROM qpl_sol_sug WHERE question_fi = %s",
2321  array('integer'),
2322  array($this->getId())
2323  );
2324  // delete the links in the int_link table
2325  include_once "./Services/COPage/classes/class.ilInternalLink.php";
2327  $this->suggested_solutions = array();
2329  }
getId()
Gets the id of the assQuestion object.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ doesSolutionRecordsExist()

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 $pass, $query, $res, and $row.

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

4087  {
4088  // check if a solution was stored in tst_solution
4089 
4090  global $ilDB;
4091 
4092  $query = "
4093  SELECT count(active_fi) cnt
4094 
4095  FROM tst_solutions
4096 
4097  WHERE active_fi = %s
4098  AND question_fi = %s
4099  AND pass = %s
4100  ";
4101 
4102  $res = $ilDB->queryF(
4103  $query, array('integer','integer','integer'),
4104  array($activeId, $questionId, $pass)
4105  );
4106 
4107  $row = $ilDB->fetchAssoc($res);
4108 
4109  $solutionRecordsExist = (
4110  0 < (int)$row['cnt'] ? true : false
4111  );
4112 
4113  return $solutionRecordsExist;
4114  }
+ Here is the caller graph for this function:

◆ duplicate()

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

Referenced by getHtmlUserSolutionPurifier().

+ Here is the caller graph for this function:

◆ duplicateQuestionHints()

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

3993  {
3994  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
3995  $hintIds = ilAssQuestionHintList::duplicateListForQuestion($originalQuestionId, $duplicateQuestionId);
3996 
3998  {
3999  require_once 'Modules/TestQuestionPool/classes/class.ilAssHintPage.php';
4000 
4001  foreach($hintIds as $originalHintId => $duplicateHintId)
4002  {
4003  $originalPageObject = new ilAssHintPage($originalHintId);
4004  $originalXML = $originalPageObject->getXMLContent();
4005 
4006  $duplicatePageObject = new ilAssHintPage();
4007  $duplicatePageObject->setId($duplicateHintId);
4008  $duplicatePageObject->setParentId($this->getId());
4009  $duplicatePageObject->setXMLContent($originalXML);
4010  $duplicatePageObject->createFromXML();
4011  }
4012  }
4013  }
getId()
Gets the id of the assQuestion object.
Assessment hint page object.
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateSuggestedSolutionFiles()

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

2402  {
2403  global $ilLog;
2404 
2405  foreach ($this->suggested_solutions as $index => $solution)
2406  {
2407  if (strcmp($solution["type"], "file") == 0)
2408  {
2409  $filepath = $this->getSuggestedSolutionPath();
2410  $filepath_original = str_replace(
2411  "/{$this->obj_id}/{$this->id}/solution",
2412  "/$parent_id/$question_id/solution",
2413  $filepath
2414  );
2415  if (!file_exists($filepath))
2416  {
2417  ilUtil::makeDirParents($filepath);
2418  }
2419  $filename = $solution["value"]["name"];
2420  if (strlen($filename))
2421  {
2422  if (!copy($filepath_original . $filename, $filepath . $filename))
2423  {
2424  $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2425  $ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
2426  }
2427  }
2428  }
2429  }
2430  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatSAQuestion()

assQuestion::formatSAQuestion (   $a_q)

Format self assessment question.

Parameters

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

3881  {
3882  include_once("./Services/RTE/classes/class.ilRTE.php");
3883  $a_q = nl2br((string) ilRTE::_replaceMediaObjectImageSrc($a_q, 0));
3884  $a_q = str_replace("</li><br />", "</li>", $a_q);
3885  $a_q = str_replace("</li><br>", "</li>", $a_q);
3886 
3887  $a_q = ilUtil::insertLatexImages($a_q, "\[tex\]", "\[\/tex\]");
3888  $a_q = ilUtil::insertLatexImages($a_q, "<span class\=\"latex\">", "<\/span>");
3889 
3890  $a_q = str_replace('{', '&#123;', $a_q);
3891  $a_q = str_replace('}', '&#125;', $a_q);
3892 
3893  return $a_q;
3894  }
static insertLatexImages($a_text, $a_start="\ex\, $a_end="\\tex\")
replace [text]...[/tex] tags with formula image code
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

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

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

References getQuestionType().

312  {
313  include_once "./Modules/TestQuestionPool/classes/import/qti12/class." . $this->getQuestionType() . "Import.php";
314  $classname = $this->getQuestionType() . "Import";
315  $import = new $classname($this);
316  $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
317  }
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:

◆ getActiveUserData()

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, and $row.

3499  {
3500  global $ilDB;
3501  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE active_id = %s",
3502  array('integer'),
3503  array($active_id)
3504  );
3505  if ($result->numRows())
3506  {
3507  $row = $ilDB->fetchAssoc($result);
3508  return array("user_id" => $row["user_fi"], "test_id" => $row["test_fi"]);
3509  }
3510  else
3511  {
3512  return array();
3513  }
3514  }
$result

◆ getAdditionalContentEditingMode()

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

4123  {
4125  }
+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name public

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

Referenced by deleteAdditionalTableData().

1581  {
1582  return "";
1583  }
+ Here is the caller graph for this function:

◆ getAdjustedReachedPoints()

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

901  {
902  if (is_null($pass))
903  {
904  include_once "./Modules/Test/classes/class.ilObjTest.php";
905  $pass = ilObjTest::_getPass($active_id);
906  }
907 
908  // determine reached points for submitted solution
909  $reached_points = $this->calculateReachedPoints($active_id, $pass);
910 
911  // deduct points for requested hints from reached points
912  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
913  $requestsStatisticData = ilAssQuestionHintTracking::getRequestStatisticDataByQuestionAndTestpass($this->getId(), $active_id, $pass);
914  $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
915 
916  // adjust reached points regarding to tests scoring options
917  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
918 
919  return $reached_points;
920  }
getId()
Gets the id of the assQuestion object.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
adjustReachedPointsByScoringOptions($points, $active_id, $pass=NULL)
Adjust the given reached points by checks for all special scoring options in the test container...
static getRequestStatisticDataByQuestionAndTestpass($questionId, $activeId, $pass)
Returns a question hint request statistic data container containing the statistics for all requests r...
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
+ Here is the call graph for this function:

◆ getAnswerTableName()

assQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name public

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

Referenced by deleteAnswers().

1592  {
1593  return "";
1594  }
+ Here is the caller graph for this function:

◆ getAuthor()

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

623  {
624  return $this->author;
625  }
+ Here is the caller graph for this function:

◆ getComment()

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

562  {
563  return $this->comment;
564  }
+ Here is the caller graph for this function:

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

Get Default Nr of Tries.

Returns
int Default Nr of Tries

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

References $defaultnroftries.

3954  {
3955  return $this->defaultnroftries;
3956  }

◆ getEstimatedWorkingTime()

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

607  {
608  if (!$this->est_working_time)
609  {
610  $this->est_working_time = array("h" => 0, "m" => 0, "s" => 0);
611  }
613  }
+ Here is the caller graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )
Returns
string

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

References $external_id, and getId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

675  {
676  if(!strlen($this->external_id))
677  {
678  if($this->getId() > 0)
679  {
680  return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
681  }
682  else
683  {
684  return uniqid('', true);
685  }
686  }
687  else
688  {
689  return $this->external_id;
690  }
691  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFeedbackClassNameByQuestionType()

static assQuestion::getFeedbackClassNameByQuestionType (   $questionType)
static

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

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

3546  {
3547  return str_replace('ass', 'ilAss', $questionType).'Feedback';
3548  }
+ Here is the caller graph for this function:

◆ getFlashPath()

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

1401  {
1402  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/flash/";
1403  }
+ Here is the caller graph for this function:

◆ getFlashPathWeb()

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

1457  {
1458  include_once "./Services/Utilities/classes/class.ilUtil.php";
1459  $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/flash/";
1461  }
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getGuiClassNameByQuestionType()

static assQuestion::getGuiClassNameByQuestionType (   $questionType)
static

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

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

3536  {
3537  return $questionType.'GUI';
3538  }
+ Here is the caller graph for this function:

◆ getHtmlUserSolutionPurifier()

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

References $author, $owner, $title, ilHtmlPurifierFactory\_getInstanceByType(), and duplicate().

4230  {
4231  require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4232  return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4233  }
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
+ Here is the call graph for this function:

◆ getId()

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(), assNumeric\contains(), assErrorText\copyObject(), assClozeTest\copyObject(), copySuggestedSolutionFiles(), 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(), assNumeric\getMaximumPoints(), assOrderingQuestion\getOldLeveledOrdering(), getQuestionTypeID(), 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(), assSingleChoice\isComplete(), 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().

526  {
527  return $this->id;
528  }
+ Here is the caller graph for this function:

◆ getImagePath()

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 assMultipleChoice\calculateReachedPoints(), assOrderingQuestion\cleanImagefiles(), assImagemapQuestion\copyImage(), assOrderingQuestion\copyImages(), assMatchingQuestion\copyImages(), assMultipleChoice\copyImages(), assSingleChoice\copyImages(), 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(), assSingleChoice\saveWorkingData(), assMatchingQuestion\setExportDetailsXLS(), assOrderingQuestion\setImageFile(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), assMatchingQuestion\setImageFile(), assImagemapQuestion\setImageFilename(), assMultipleChoice\syncImages(), and assSingleChoice\syncImages().

1380  {
1381  if( $question_id === null)
1382  {
1383  $question_id = $this->id;
1384  }
1385 
1386  if( $object_id === null)
1387  {
1388  $object_id = $this->obj_id;
1389  }
1390 
1391  return CLIENT_WEB_DIR . "/assessment/$object_id/$question_id/images/";
1392  }
+ Here is the caller graph for this function:

◆ getImagePathWeb()

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

1437  {
1438  if(!$this->export_image_path)
1439  {
1440  include_once "./Services/Utilities/classes/class.ilUtil.php";
1441  $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/images/";
1443  }
1444  else
1445  {
1446  return $this->export_image_path;
1447  }
1448  }
$export_image_path
(Web) Path to images
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstances()

& 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, $row, ilObject\_getAllReferences(), ilObjTest\_lookupAuthor(), ilObject\_lookupTitle(), and getId().

3434  {
3435  global $ilDB;
3436 
3437  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s",
3438  array("integer"),
3439  array($this->getId())
3440  );
3441  $instances = array();
3442  $ids = array();
3443  while ($row = $ilDB->fetchAssoc($result))
3444  {
3445  array_push($ids, $row["question_id"]);
3446  }
3447  foreach ($ids as $question_id)
3448  {
3449  // check non random tests
3450  $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",
3451  array("integer"),
3452  array($question_id)
3453  );
3454  while ($row = $ilDB->fetchAssoc($result))
3455  {
3456  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3457  }
3458  // check random tests
3459  $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",
3460  array("integer"),
3461  array($question_id)
3462  );
3463  while ($row = $ilDB->fetchAssoc($result))
3464  {
3465  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3466  }
3467  }
3468  include_once "./Modules/Test/classes/class.ilObjTest.php";
3469  foreach ($instances as $key => $value)
3470  {
3471  $instances[$key] = array("obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key));
3472  }
3473  return $instances;
3474  }
getId()
Gets the id of the assQuestion object.
_lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
$result
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:

◆ getJavaPath()

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

1369  {
1370  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/java/";
1371  }
+ Here is the caller graph for this function:

◆ getJavaPathWeb()

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

1412  {
1413  include_once "./Services/Utilities/classes/class.ilUtil.php";
1414  $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/java/";
1416  }
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getMaximumPoints()

assQuestion::getMaximumPoints ( )

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

public

See also
$points

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

References $points.

Referenced by adjustReachedPointsByScoringOptions(), and saveQuestionDataToDb().

885  {
886  return $this->points;
887  }
+ Here is the caller graph for this function:

◆ getNrOfTries()

◆ getObjectClassNameByQuestionType()

static assQuestion::getObjectClassNameByQuestionType (   $questionType)
static

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

3541  {
3542  return $questionType;
3543  }

◆ getObjId()

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

647  {
648  return $this->obj_id;
649  }
+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

◆ getOutputType()

assQuestion::getOutputType ( )

Gets the output type.

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

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

References $outputType.

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

574  {
575  return $this->outputType;
576  }
+ Here is the caller graph for this function:

◆ getOwner()

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

635  {
636  return $this->owner;
637  }
+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

References $page.

2009  {
2010  include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2011  $page = new ilAssQuestionPage($this->id);
2012  return $page->getXMLContent();
2013  }
Question page object.

◆ getPoints()

assQuestion::getPoints ( )

Returns the maximum available points for the question.

Returns
integer The points public

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

References $points.

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

2889  {
2890  if (strcmp($this->points, "") == 0)
2891  {
2892  return 0;
2893  }
2894  else
2895  {
2896  return $this->points;
2897  }
2898  }
+ Here is the caller graph for this function:

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

Get prevent rte usage.

Returns
boolean prevent rte usage

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

References $prevent_rte_usage.

3914  {
3915  return $this->prevent_rte_usage;
3916  }

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionChangeListeners()

assQuestion::getQuestionChangeListeners ( )
Returns
array[ilQuestionChangeListener]

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

References $questionChangeListeners.

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

4198  {
4200  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

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

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

3331  {
3332  // must be overwritten in every parent class
3333  return "";
3334  }
+ Here is the caller graph for this function:

◆ getQuestionTypeFromDb()

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 $data, $result, and ilDB\fetchAssoc().

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

1563  {
1564  global $ilDB;
1565 
1566  $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",
1567  array('integer'),
1568  array($question_id)
1569  );
1570  $data = $ilDB->fetchAssoc($result);
1571  return $data["type_tag"];
1572  }
$result
fetchAssoc($a_set)
Fetch row as associative array from result set.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionTypeID()

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, $row, getId(), and getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

3345  {
3346  global $ilDB;
3347 
3348  $result = $ilDB->queryF("SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
3349  array('text'),
3350  array($this->getQuestionType())
3351  );
3352  if ($result->numRows() == 1)
3353  {
3354  $row = $ilDB->fetchAssoc($result);
3355  return $row["question_type_id"];
3356  }
3357  return 0;
3358  }
$result
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReachedPoints()

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

874  {
875  return round($this->_getReachedPoints($active_id, $this->getId(), $pass), 2);
876  }
getId()
Gets the id of the assQuestion object.
_getReachedPoints($active_id, $question_id, $pass=NULL)
Returns the points, a learner has reached answering the question.
+ Here is the call graph for this function:

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )

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

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

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

Referenced by cleanupMediaObjectUsage().

3400  {
3401  // must be called in parent classes. add additional RTE text in the parent
3402  // classes and call this method to add the standard RTE text
3403  $collected = $this->getQuestion();
3404  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
3405  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
3406  for( $i = 0; $i <= $this->getTotalAnswers(); $i++ )
3407  {
3408  $collected .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->getId(), $i);
3409  }
3410  foreach ($this->suggested_solutions as $solution_array)
3411  {
3412  $collected .= $solution_array["value"];
3413  }
3414  return $collected;
3415  }
getId()
Gets the id of the assQuestion object.
getTotalAnswers()
get total number of answers
getQuestion()
Gets the question string of the question object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

Get Self-Assessment Editing Mode.

Returns
boolean Self-Assessment Editing Mode

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

References $selfassessmenteditingmode.

3934  {
3936  }

◆ getShuffle()

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(), assMultipleChoice\calculateReachedPoints(), assSingleChoice\saveWorkingData(), assTextQuestion\toJSON(), assImagemapQuestion\toJSON(), assSingleChoice\toJSON(), assMultipleChoice\toJSON(), assErrorText\toJSON(), and assClozeTest\toJSON().

538  {
539  return $this->shuffle;
540  }
+ Here is the caller graph for this function:

◆ getSolutionMaxPass()

◆ getSolutionValues()

& 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 $pass, $result, $row, 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().

1471  {
1472  global $ilDB;
1473 
1474  $values = array();
1475 
1476  if (is_null($pass))
1477  {
1478  $pass = $this->getSolutionMaxPass($active_id);
1479  }
1480 
1481  $result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s ORDER BY solution_id",
1482  array('integer','integer','integer'),
1483  array($active_id, $this->getId(), $pass)
1484  );
1485  while ($row = $ilDB->fetchAssoc($result))
1486  {
1487  array_push($values, $row);
1488  }
1489 
1490  return $values;
1491  }
getId()
Gets the id of the assQuestion object.
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedSolution()

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.

2339  {
2340  if (array_key_exists($subquestion_index, $this->suggested_solutions))
2341  {
2342  return $this->suggested_solutions[$subquestion_index];
2343  }
2344  else
2345  {
2346  return array();
2347  }
2348  }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

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

768  {
769  $output = array();
770  foreach ($this->suggested_solutions as $solution)
771  {
772  switch ($solution["type"])
773  {
774  case "lm":
775  case "st":
776  case "pg":
777  case "git":
778  array_push($output, '<a href="' . assQuestion::_getInternalLinkHref($solution["internal_link"]) . '">' . $this->lng->txt("solution_hint") . '</a>');
779  break;
780  case "file":
781  $possible_texts = array_values(array_filter(array(
782  ilUtil::prepareFormOutput($solution['value']['filename']),
783  ilUtil::prepareFormOutput($solution['value']['name']),
784  $this->lng->txt('tst_show_solution_suggested')
785  )));
786  array_push($output, '<a href="' . $this->getSuggestedSolutionPathWeb() . $solution["value"]["name"] . '">' . $possible_texts[0] . '</a>');
787  break;
788  case "text":
789  array_push($output, $this->prepareTextareaOutput($solution["value"], true));
790  break;
791  }
792  }
793  return join($output, "<br />");
794  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output in tests.
_getInternalLinkHref($target="")
getSuggestedSolutionPathWeb()
Returns the web path for a suggested solution.
+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

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

1359  {
1360  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
1361  }
+ Here is the caller graph for this function:

◆ getSuggestedSolutionPathWeb()

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

1424  {
1425  include_once "./Services/Utilities/classes/class.ilUtil.php";
1426  $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/solution/";
1428  }
const ILIAS_ABSOLUTE_PATH
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedSolutions()

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

832  {
834  }
+ Here is the caller graph for this function:

◆ getSuggestedSolutionTitle()

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.

2359  {
2360  if (array_key_exists($subquestion_index, $this->suggested_solutions))
2361  {
2362  $title = $this->suggested_solutions[$subquestion_index]["internal_link"];
2363  // TO DO: resolve internal link an get link type and title
2364  }
2365  else
2366  {
2367  $title = "";
2368  }
2369  return $title;
2370  }

◆ getTestId()

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

550  {
551  return $this->test_id;
552  }
+ Here is the caller graph for this function:

◆ getTitle()

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

get total number of answers

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

References _getTotalAnswers().

Referenced by getRTETextWithMediaObjects().

1828  {
1829  return $this->_getTotalAnswers($this->id);
1830  }
_getTotalAnswers($a_q_id)
get number of answers for question id (static) note: do not use $this inside this method ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidAdditionalContentEditingModes()

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

4179  {
4180  return array(
4181  self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
4182  self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
4183  );
4184  }
+ Here is the caller graph for this function:

◆ includeCoreClass()

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

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

3557  {
3558  if( $withGuiClass )
3559  {
3560  $guiClassName = self::getGuiClassNameByQuestionType($questionType);
3561  require_once "Modules/TestQuestionPool/classes/class.{$guiClassName}.php";
3562 
3563  // object class is included by gui classes constructor
3564  }
3565  else
3566  {
3567  $objectClassName = self::getObjectClassNameByQuestionType($questionType);
3568  require_once "Modules/TestQuestionPool/classes/class.{$objectClassName}.php";
3569  }
3570 
3571  $feedbackClassName = self::getFeedbackClassNameByQuestionType($questionType);
3572  require_once "Modules/TestQuestionPool/classes/feedback/class.{$feedbackClassName}.php";
3573  }

◆ includePluginClass()

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

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

References ilPlugin\getPluginObject(), and IL_COMP_MODULE.

3576  {
3577  global $ilPluginAdmin;
3578 
3579  $classes = array(
3580  self::getObjectClassNameByQuestionType($questionType),
3581  self::getFeedbackClassNameByQuestionType($questionType)
3582  );
3583 
3584  if( $withGuiClass )
3585  {
3586  $classes[] = self::getGuiClassNameByQuestionType($questionType);
3587  }
3588 
3589  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
3590  foreach ($pl_names as $pl_name)
3591  {
3592  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
3593  if (strcmp($pl->getQuestionType(), $questionType) == 0)
3594  {
3595  foreach($classes as $class)
3596  {
3597  $pl->includeClass("class.{$class}.php");
3598  }
3599 
3600  break;
3601  }
3602  }
3603  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const IL_COMP_MODULE
+ Here is the call graph for this function:

◆ instantiateQuestionGUI()

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(), and _includeClass().

Referenced by ilObjTestGUI\copyQuestionToPool(), ilScoringAdjustmentGUI\dispatchCommand(), and ilScoringAdjustmentGUI\outputAdjustQuestionForm().

3656  {
3657  global $ilCtrl, $ilDB, $lng, $ilUser;
3658 
3659  if (strcmp($a_question_id, "") != 0)
3660  {
3661  $question_type = assQuestion::_getQuestionType($a_question_id);
3662 
3663  assQuestion::_includeClass($question_type, 1);
3664 
3665  $question_type_gui = self::getGuiClassNameByQuestionType($question_type);
3666  $question_gui = new $question_type_gui();
3667  $question_gui->object->loadFromDb($a_question_id);
3668 
3669  $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
3670  $question_gui->object->feedbackOBJ = new $feedbackObjectClassname($question_gui->object, $ilCtrl, $ilDB, $lng);
3671 
3672  $assSettings = new ilSetting('assessment');
3673  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
3674  $processLockerFactory = new ilAssQuestionProcessLockerFactory($assSettings, $ilDB);
3675  $processLockerFactory->setQuestionId($question_gui->object->getId());
3676  $processLockerFactory->setUserId($ilUser->getId());
3677  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3678  $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
3679  $question_gui->object->setProcessLocker($processLockerFactory->getLocker());
3680  }
3681  else
3682  {
3683  global $ilLog;
3684  $ilLog->write('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', $ilLog->WARNING);
3685  return null;
3686  }
3687  return $question_gui;
3688  }
ILIAS Setting Class.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getQuestionType($question_id)
Returns the question type of a question with a given id.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAdditionalContentEditingModePageObject()

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

4151  {
4153  }
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnswered()

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

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

Referenced by calculateResultsFromSolution().

4028  {
4029  return true;
4030  }
+ Here is the caller graph for this function:

◆ isAutosaveable()

assQuestion::isAutosaveable ( )

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

4070  {
4071  return TRUE;
4072  }

◆ isClone()

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, $result, and $row.

1527  {
1528  global $ilDB;
1529 
1530  if ($question_id < 1) $question_id = $this->id;
1531  $result = $ilDB->queryF("SELECT original_id FROM qpl_questions WHERE question_id = %s",
1532  array('integer'),
1533  array($question_id)
1534  );
1535  $row = $ilDB->fetchAssoc($result);
1536  return ($row["original_id"] > 0) ? TRUE : FALSE;
1537  }
$result

◆ isComplete()

assQuestion::isComplete ( )

Returns true, if a question is complete for use.

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

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

Referenced by saveToDb().

340  {
341  return false;
342  }
+ Here is the caller graph for this function:

◆ isCoreQuestionType()

static assQuestion::isCoreQuestionType (   $questionType)
static

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

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

◆ isHTML()

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

3114  {
3115  if (preg_match("/<[^>]*?>/", $a_text))
3116  {
3117  return TRUE;
3118  }
3119  else
3120  {
3121  return FALSE;
3122  }
3123  }
+ Here is the caller graph for this function:

◆ isInUse()

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, $row, and getId().

1500  {
1501  global $ilDB;
1502 
1503  if ($question_id < 1) $question_id = $this->getId();
1504  $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",
1505  array('integer'),
1506  array($question_id)
1507  );
1508  $row = $ilDB->fetchAssoc($result);
1509  $count = $row["question_count"];
1510 
1511  $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",
1512  array('integer'),
1513  array($question_id)
1514  );
1515  $count += $result->numRows();
1516 
1517  return $count;
1518  }
getId()
Gets the id of the assQuestion object.
$result
+ Here is the call graph for this function:

◆ isObligationPossible()

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

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

Referenced by assMultipleChoice\isAnswered().

4045  {
4046  return false;
4047  }
+ Here is the caller graph for this function:

◆ isValidAdditionalContentEditingMode()

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

4163  {
4164  if( in_array($additionalContentEditingMode, $this->getValidAdditionalContentEditingModes()) )
4165  {
4166  return true;
4167  }
4168 
4169  return false;
4170  }
getValidAdditionalContentEditingModes()
getter for valid additional content editing modes
+ Here is the call graph for this function:

◆ keyInArray()

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.

464  {
465  if ($searchkey)
466  {
467  foreach ($array as $key => $value)
468  {
469  if (strcmp($key, $searchkey)==0)
470  {
471  return true;
472  }
473  }
474  }
475  return false;
476  }

◆ loadFromDb()

assQuestion::loadFromDb (   $question_id)

Loads the question from the database.

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

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

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

Referenced by assNumeric\saveToDb().

2087  {
2088  global $ilDB;
2089 
2090  $result = $ilDB->queryF(
2091  "SELECT external_id FROM qpl_questions WHERE question_id = %s",
2092  array("integer"),
2093  array($question_id)
2094  );
2095  if($result->numRows() == 1)
2096  {
2097  $data = $ilDB->fetchAssoc($result);
2098  $this->external_id = $data['external_id'];
2099  }
2100 
2101  $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2102  array('integer'),
2103  array($this->getId())
2104  );
2105  $this->suggested_solutions = array();
2106  if ($result->numRows())
2107  {
2108  include_once("./Services/RTE/classes/class.ilRTE.php");
2109  while ($row = $ilDB->fetchAssoc($result))
2110  {
2111  $value = (is_array(unserialize($row["value"]))) ? unserialize($row["value"]) : ilRTE::_replaceMediaObjectImageSrc($row["value"], 1);
2112  $this->suggested_solutions[$row["subquestion_index"]] = array(
2113  "type" => $row["type"],
2114  "value" => $value,
2115  "internal_link" => $row["internal_link"],
2116  "import_id" => $row["import_id"]
2117  );
2118  }
2119  }
2120  }
getId()
Gets the id of the assQuestion object.
$result
fetchAssoc($a_set)
Fetch row as associative array from result set.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logAction()

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 assMultipleChoice\calculateReachedPoints(), calculateResultsFromSolution(), assNumeric\contains(), 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().

1294  {
1295  global $ilUser;
1296 
1297  $original_id = "";
1298  if (strcmp($question_id, "") != 0)
1299  {
1300  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1301  $original_id = assQuestion::_getOriginalId($question_id);
1302  }
1303  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1304  include_once "./Modules/Test/classes/class.ilObjTest.php";
1305  ilObjAssessmentFolder::_addLog($ilUser->id, ilObjTest::_getObjectIDFromActiveID($active_id), $logtext, $question_id, $original_id);
1306  }
static _getOriginalId($question_id)
Returns the original id of a question.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupOriginalParentObjId()

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.

3988  {
3989  return self::lookupParentObjId($originalQuestionId);
3990  }

◆ lookupParentObjId()

static assQuestion::lookupParentObjId (   $questionId)
static

ilDB $ilDB

Parameters
integer$questionId
Returns
integer $parentObjectId

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

References $query, $res, and $row.

Referenced by ilObjTestGUI\copyAndLinkToQuestionpoolObject().

3966  {
3967  global $ilDB;
3968 
3969  $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
3970 
3971  $res = $ilDB->queryF($query, array('integer'), array((int)$questionId));
3972  $row = $ilDB->fetchAssoc($res);
3973 
3974  return $row['obj_fi'];
3975  }
+ Here is the caller graph for this function:

◆ moveUploadedMediaFile()

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

1338  {
1339  $mediatempdir = CLIENT_WEB_DIR . "/assessment/temp";
1340  if (!@is_dir($mediatempdir)) ilUtil::createDirectory($mediatempdir);
1341  $temp_name = tempnam($mediatempdir, $name . "_____");
1342  $temp_name = str_replace("\\", "/", $temp_name);
1343  @unlink($temp_name);
1344  if (!ilUtil::moveUploadedFile($file, $name, $temp_name))
1345  {
1346  return FALSE;
1347  }
1348  else
1349  {
1350  return $temp_name;
1351  }
1352  }
print $file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static createDirectory($a_dir, $a_mod=0755)
create directory
+ Here is the call graph for this function:

◆ notifyQuestionCreated()

assQuestion::notifyQuestionCreated ( )
private

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

References getQuestionChangeListeners().

Referenced by createNewQuestion().

4203  {
4204  foreach($this->getQuestionChangeListeners() as $listener)
4205  {
4206  $listener->notifyQuestionCreated($this);
4207  }
4208  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyQuestionDeleted()

assQuestion::notifyQuestionDeleted ( )
private

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

References getQuestionChangeListeners().

Referenced by delete().

4219  {
4220  foreach($this->getQuestionChangeListeners() as $listener)
4221  {
4222  $listener->notifyQuestionDeleted($this);
4223  }
4224  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyQuestionEdited()

assQuestion::notifyQuestionEdited ( )
private

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

References getQuestionChangeListeners().

Referenced by saveToDb().

4211  {
4212  foreach($this->getQuestionChangeListeners() as $listener)
4213  {
4214  $listener->notifyQuestionEdited($this);
4215  }
4216  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onCopy()

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

2303  {
2304  $this->copySuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
2305 
2306  // duplicate question feeback
2307  $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
2308 
2309  // duplicate question hints
2310  $this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
2311  }
copySuggestedSolutionFiles($source_questionpool_id, $source_question_id)
duplicateQuestionHints($originalQuestionId, $duplicateQuestionId)
+ Here is the call graph for this function:

◆ onDuplicate()

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

2283  {
2284  $this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
2285 
2286  // duplicate question feeback
2287  $this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
2288 
2289  // duplicate question hints
2290  $this->duplicateQuestionHints($originalQuestionId, $duplicateQuestionId);
2291  }
duplicateQuestionHints($originalQuestionId, $duplicateQuestionId)
duplicateSuggestedSolutionFiles($parent_id, $question_id)
Duplicates the files of a suggested solution if the question is duplicated.
+ Here is the call graph for this function:

◆ onSyncWithOriginal()

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

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

Referenced by syncWithOriginal().

2294  {
2295  // sync question feeback
2296  $this->feedbackOBJ->syncFeedback($originalQuestionId, $duplicateQuestionId);
2297  }
+ Here is the caller graph for this function:

◆ originalQuestionExists()

static assQuestion::originalQuestionExists (   $questionId)
static

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

References $query, $res, and $row.

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

2733  {
2734  global $ilDB;
2735 
2736  $query = "
2737  SELECT COUNT(dupl.question_id) cnt
2738  FROM qpl_questions dupl
2739  INNER JOIN qpl_questions orig
2740  ON orig.question_id = dupl.original_id
2741  WHERE dupl.question_id = %s
2742  ";
2743 
2744  $res = $ilDB->queryF($query, array('integer'), array($questionId));
2745  $row = $ilDB->fetchAssoc($res);
2746 
2747  return $row['cnt'] > 0;
2748  }
+ Here is the caller graph for this function:

◆ pcArrayShuffle()

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

1546  {
1547  $keys = array_keys($array);
1548  shuffle($keys);
1549  $result = array();
1550  foreach ($keys as $key)
1551  {
1552  $result[$key] = $array[$key];
1553  }
1554  return $result;
1555  }
$result
+ Here is the caller graph for this function:

◆ persistWorkingState()

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

1026  {
1027  if( $pass === null )
1028  {
1029  require_once 'Modules/Test/classes/class.ilObjTest.php';
1030  $pass = ilObjTest::_getPass($active_id);
1031  }
1032 
1033  $this->getProcessLocker()->requestPersistWorkingStateLock();
1034 
1035  $saveStatus = $this->saveWorkingData($active_id, $pass);
1036 
1037  $this->calculateResultsFromSolution($active_id, $pass, $obligationsEnabled);
1038 
1039  $this->reworkWorkingData($active_id, $pass, $obligationsEnabled);
1040 
1041  $this->getProcessLocker()->releasePersistWorkingStateLock();
1042 
1043  return $saveStatus;
1044  }
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
calculateResultsFromSolution($active_id, $pass=NULL, $obligationsEnabled=false)
Calculates the question results from a previously saved question solution.
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
saveWorkingData($active_id, $pass=NULL)
Saves the learners input of the question to the database.
+ Here is the call graph for this function:

◆ prepareTextareaOutput()

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.

References ilUtil\prepareTextareaOutput().

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

3132  {
3133  include_once "./Services/Utilities/classes/class.ilUtil.php";
3134  return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
3135  }
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QTIMaterialToString()

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.

3145  {
3146  $result = "";
3147  for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
3148  {
3149  $material = $a_material->getMaterial($i);
3150  if (strcmp($material["type"], "mattext") == 0)
3151  {
3152  $result .= $material["material"]->getContent();
3153  }
3154  if (strcmp($material["type"], "matimage") == 0)
3155  {
3156  $matimage = $material["material"];
3157  if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
3158  {
3159  // import an mediaobject which was inserted using tiny mce
3160  if (!is_array($_SESSION["import_mob_xhtml"])) $_SESSION["import_mob_xhtml"] = array();
3161  array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
3162  }
3163  }
3164  }
3165  return $result;
3166  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result

◆ questionTitleExists()

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.

352  {
353  global $ilDB;
354 
355  $result = $ilDB->queryF("SELECT * FROM qpl_questions WHERE obj_fi = %s AND title = %s",
356  array('integer','text'),
357  array($questionpool_id, $title)
358  );
359  return ($result->numRows() == 1) ? TRUE : FALSE;
360  }
$result

◆ requiresJsSwitch()

assQuestion::requiresJsSwitch ( )

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

References supportsJavascriptOutput(), and supportsNonJsOutput().

595  {
596  return $this->supportsJavascriptOutput() && $this->supportsNonJsOutput();
597  }
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
+ Here is the call graph for this function:

◆ reworkWorkingData()

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

Reworks the allready saved working data if neccessary.

protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

◆ saveQuestionDataToDb()

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 assSingleChoice\isComplete(), 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().

2183  {
2184  global $ilDB;
2185 
2186  $estw_time = $this->getEstimatedWorkingTime();
2187  $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2188 
2189  // cleanup RTE images which are not inserted into the question text
2190  include_once("./Services/RTE/classes/class.ilRTE.php");
2191  if ($this->getId() == -1)
2192  {
2193  // Neuen Datensatz schreiben
2194  $next_id = $ilDB->nextId('qpl_questions');
2195  $affectedRows = $ilDB->insert("qpl_questions", array(
2196  "question_id" => array("integer", $next_id),
2197  "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2198  "obj_fi" => array("integer", $this->getObjId()),
2199  "title" => array("text", $this->getTitle()),
2200  "description" => array("text", $this->getComment()),
2201  "author" => array("text", $this->getAuthor()),
2202  "owner" => array("integer", $this->getOwner()),
2203  "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2204  "points" => array("float", $this->getMaximumPoints()),
2205  "working_time" => array("text", $estw_time),
2206  "nr_of_tries" => array("integer", (strlen($this->getNrOfTries())) ? $this->getNrOfTries() : 1),
2207  "created" => array("integer", time()),
2208  "original_id" => array("integer", ($original_id) ? $original_id : NULL),
2209  "tstamp" => array("integer", time()),
2210  "external_id" => array("text", $this->getExternalId()),
2211  'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2212  ));
2213  $this->setId($next_id);
2214  // create page object of question
2215  $this->createPageObject();
2216  }
2217  else
2218  {
2219  // Vorhandenen Datensatz aktualisieren
2220  $affectedRows = $ilDB->update("qpl_questions", array(
2221  "obj_fi" => array("integer", $this->getObjId()),
2222  "title" => array("text", $this->getTitle()),
2223  "description" => array("text", $this->getComment()),
2224  "author" => array("text", $this->getAuthor()),
2225  "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2226  "points" => array("float", $this->getMaximumPoints()),
2227  "nr_of_tries" => array("integer", (strlen($this->getNrOfTries())) ? $this->getNrOfTries() : 1),
2228  "working_time" => array("text", $estw_time),
2229  "tstamp" => array("integer", time()),
2230  "external_id" => array("text", $this->getExternalId())
2231  ), array(
2232  "question_id" => array("integer", $this->getId())
2233  ));
2234  }
2235  }
getId()
Gets the id of the assQuestion object.
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getObjId()
Get the object id of the container object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestionTypeID()
Returns the question type of the question.
getQuestion()
Gets the question string of the question object.
getComment()
Gets the comment string of the assQuestion object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getOwner()
Gets the creator/owner ID of the assQuestion object.
getEstimatedWorkingTime()
Gets the estimated working time of a question.
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

assQuestion::saveToDb (   $original_id = "")

Saves the question to the database.

Parameters
integer$original_idpublic

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

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

Referenced by assSingleChoice\isComplete(), and syncWithOriginal().

2244  {
2245  global $ilDB;
2246 
2247  $this->updateSuggestedSolutions();
2248 
2249  // remove unused media objects from ILIAS
2250  $this->cleanupMediaObjectUsage();
2251 
2252  $complete = "0";
2253  if ($this->isComplete())
2254  {
2255  $complete = "1";
2256  }
2257 
2258  // update the question time stamp and completion status
2259  $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s",
2260  array('integer','integer', 'integer','text'),
2261  array(time(), ($this->getOwner() <= 0) ? $this->ilias->account->id : $this->getOwner(), $complete, $this->getId())
2262  );
2263 
2264  // update question count of question pool
2265  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2267 
2268  $this->notifyQuestionEdited($this);
2269  }
getId()
Gets the id of the assQuestion object.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
isComplete()
Returns true, if a question is complete for use.
redirection script todo: (a better solution should control the processing via a xml file) ...
cleanupMediaObjectUsage()
synchronises appearances of media objects in the question with media object usage table ...
getOwner()
Gets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveWorkingData()

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

Referenced by assMultipleChoice\calculateReachedPoints(), assNumeric\contains(), and persistWorkingState().

+ Here is the caller graph for this function:

◆ setAdditionalContentEditingMode()

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(), assFormulaQuestion\loadFromDb(), and assNumeric\saveToDb().

4134  {
4136  {
4137  require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
4138  throw new ilTestQuestionPoolException('invalid additional content editing mode given: '.$additinalContentEditingMode);
4139  }
4140 
4141  $this->additinalContentEditingMode = $additinalContentEditingMode;
4142  }
getValidAdditionalContentEditingModes()
getter for valid additional content editing modes
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAuthor()

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(), assFormulaQuestion\loadFromDb(), and assNumeric\saveToDb().

486  {
487  if (!$author)
488  {
489  $author = $this->ilias->account->fullname;
490  }
491  $this->author = $author;
492  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the caller graph for this function:

◆ setComment()

assQuestion::setComment (   $comment = "")

◆ setDefaultNrOfTries()

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.

3944  {
3945  $this->defaultnroftries = $a_defaultnroftries;
3946  }

◆ setEstimatedWorkingTime()

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(), assTextQuestion\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assErrorText\loadFromDb(), assClozeTest\loadFromDb(), assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), assMatchingQuestion\loadFromDb(), assJavaApplet\loadFromDb(), assImagemapQuestion\loadFromDb(), assFormulaQuestion\loadFromDb(), and assNumeric\saveToDb().

452  {
453  $this->est_working_time = array("h" => (int)$hour, "m" => (int)$min, "s" => (int)$sec);
454  }
+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

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

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

3703  {
3704  return $startrow;
3705  }

◆ setExportImagePath()

assQuestion::setExportImagePath (   $a_path)

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

3847  {
3848  $this->export_image_path = (string)$a_path;
3849  }

◆ setExternalId()

assQuestion::setExternalId (   $external_id)
Parameters
string$external_id

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

References $external_id.

Referenced by __construct().

667  {
668  $this->external_id = $external_id;
669  }
+ Here is the caller graph for this function:

◆ setId()

◆ setNewOriginalId()

assQuestion::setNewOriginalId (   $newId)

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

References getId().

2271  {
2272  global $ilDB;
2273  $ilDB->manipulateF("UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s",
2274  array('integer','integer', 'text'),
2275  array(time(), $newId, $this->getId())
2276  );
2277  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:

◆ setNrOfTries()

◆ setObjId()

assQuestion::setObjId (   $obj_id = 0)

◆ setObligationsToBeConsidered()

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.

4055  {
4056  $this->obligationsToBeConsidered = (bool)$obligationsToBeConsidered;
4057  }

◆ setOriginalId()

◆ setOutputType()

assQuestion::setOutputType (   $outputType = OUTPUT_HTML)

Sets the output type.

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

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

References $outputType.

Referenced by __set().

418  {
419  $this->outputType = $outputType;
420  }
+ Here is the caller graph for this function:

◆ setOwner()

assQuestion::setOwner (   $owner = "")

◆ setPoints()

assQuestion::setPoints (   $a_points)

◆ setPreventRteUsage()

assQuestion::setPreventRteUsage (   $a_val)

Set prevent rte usage.

Parameters
booleanprevent rte usage

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

3904  {
3905  $this->prevent_rte_usage = $a_val;
3906  }

◆ setProcessLocker()

assQuestion::setProcessLocker (   $processLocker)
Parameters
\ilAssQuestionProcessLocker$processLocker

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

References $processLocker.

288  {
289  $this->processLocker = $processLocker;
290  }

◆ setQuestion()

assQuestion::setQuestion (   $question = "")

◆ setSelfAssessmentEditingMode()

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.

3924  {
3925  $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
3926  }

◆ setShuffle()

assQuestion::setShuffle (   $shuffle = true)

Sets the shuffle flag.

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

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

References $shuffle.

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

431  {
432  if ($shuffle)
433  {
434  $this->shuffle = 1;
435  }
436  else
437  {
438  $this->shuffle = 0;
439  }
440  }
+ Here is the caller graph for this function:

◆ setSuggestedSolution()

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

2382  {
2383  if (strcmp($solution_id, "") != 0)
2384  {
2385  $import_id = "";
2386  if ($is_import)
2387  {
2388  $import_id = $solution_id;
2389  $solution_id = $this->_resolveInternalLink($import_id);
2390  }
2391  $this->suggested_solutions[$subquestion_index] = array(
2392  "internal_link" => $solution_id,
2393  "import_id" => $import_id
2394  );
2395  }
2396  }
_resolveInternalLink($internal_link)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTestId()

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

394  {
395  $this->test_id = $id;
396  }
+ Here is the caller graph for this function:

◆ setTitle()

assQuestion::setTitle (   $title = "")

◆ supportsJavascriptOutput()

assQuestion::supportsJavascriptOutput ( )

Returns true if the question type supports JavaScript output.

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

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

Referenced by requiresJsSwitch().

585  {
586  return FALSE;
587  }
+ Here is the caller graph for this function:

◆ supportsNonJsOutput()

assQuestion::supportsNonJsOutput ( )

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

Referenced by requiresJsSwitch().

590  {
591  return true;
592  }
+ Here is the caller graph for this function:

◆ syncSuggestedSolutionFiles()

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

Referenced by copySuggestedSolutionFiles().

2436  {
2437  global $ilLog;
2438 
2439  $filepath = $this->getSuggestedSolutionPath();
2440  $filepath_original = str_replace("/$this->id/solution", "/$original_id/solution", $filepath);
2441  ilUtil::delDir($filepath_original);
2442  foreach ($this->suggested_solutions as $index => $solution)
2443  {
2444  if (strcmp($solution["type"], "file") == 0)
2445  {
2446  if (!file_exists($filepath_original))
2447  {
2448  ilUtil::makeDirParents($filepath_original);
2449  }
2450  $filename = $solution["value"]["name"];
2451  if (strlen($filename))
2452  {
2453  if (!@copy($filepath . $filename, $filepath_original . $filename))
2454  {
2455  $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2456  $ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
2457  }
2458  }
2459  }
2460  }
2461  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$filename
Definition: buildRTE.php:89
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

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

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

2751  {
2752  global $ilDB;
2753 
2754  if( !$this->getOriginalId() )
2755  {
2756  return;
2757  }
2758 
2759  $originalObjId = self::lookupOriginalParentObjId($this->getOriginalId());
2760 
2761  if ( !$originalObjId )
2762  {
2763  return;
2764  }
2765 
2766  $id = $this->getId();
2767  $original = $this->getOriginalId();
2768 
2769  $this->setId($this->getOriginalId());
2770  $this->setOriginalId(NULL);
2771  $this->setObjId($originalObjId);
2772  $this->saveToDb();
2773  $this->deletePageOfQuestion($original);
2774  $this->createPageObject();
2775  $this->copyPageOfQuestion($id);
2776 
2777  $this->setId($id);
2778  $this->setOriginalId($original);
2779  $this->updateSuggestedSolutions($original);
2781 
2782  $this->onSyncWithOriginal($original, $this->getId());
2783  $this->syncHints();
2784  }
deletePageOfQuestion($question_id)
Deletes the page object of a question with a given ID.
getId()
Gets the id of the assQuestion object.
saveToDb($original_id="")
Saves the question to the database.
copyPageOfQuestion($a_q_id)
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
onSyncWithOriginal($originalQuestionId, $duplicateQuestionId)
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
+ Here is the call graph for this function:

◆ syncXHTMLMediaObjectsOfQuestion()

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

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

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

Referenced by syncWithOriginal().

1969  {
1970  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1971  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1972  foreach ($mobs as $mob)
1973  {
1974  ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->original_id);
1975  }
1976  }
getId()
Gets the id of the assQuestion object.
$mobs
_saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

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

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

References getQuestionType().

326  {
327  include_once "./Modules/TestQuestionPool/classes/export/qti12/class." . $this->getQuestionType() . "Export.php";
328  $classname = $this->getQuestionType() . "Export";
329  $export = new $classname($this);
330  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
331  }
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:

Field Documentation

◆ $additinalContentEditingMode

assQuestion::$additinalContentEditingMode = null
private

◆ $arrData

assQuestion::$arrData
private

Associative array to store properties.

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

◆ $author

◆ $comment

◆ $defaultnroftries

assQuestion::$defaultnroftries = false

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

Referenced by getDefaultNrOfTries().

◆ $est_working_time

assQuestion::$est_working_time
protected

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

Referenced by getEstimatedWorkingTime().

◆ $export_image_path

assQuestion::$export_image_path
private

(Web) Path to images

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

Referenced by getImagePathWeb().

◆ $external_id

assQuestion::$external_id = ''
protected

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

Referenced by getExternalId(), and setExternalId().

◆ $feedbackOBJ

assQuestion::$feedbackOBJ = null

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

◆ $id

◆ $ilias

assQuestion::$ilias
protected

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

Referenced by __construct(), and __get().

◆ $lng

assQuestion::$lng
protected

◆ $nr_of_tries

assQuestion::$nr_of_tries
private

Number of tries.

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

Referenced by getNrOfTries().

◆ $obj_id

assQuestion::$obj_id
protected

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

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

◆ $obligationsToBeConsidered

assQuestion::$obligationsToBeConsidered = false
private

◆ $original_id

assQuestion::$original_id
protected

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

Referenced by _logAction(), 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(), copySuggestedSolutionFiles(), 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(), assTextQuestion\duplicateAnswers(), getOriginalId(), assSingleChoice\isComplete(), logAction(), saveQuestionDataToDb(), assOrderingHorizontal\saveToDb(), assFileUpload\saveToDb(), assErrorText\saveToDb(), assNumeric\saveToDb(), assFlashQuestion\saveToDb(), assTextSubset\saveToDb(), assTextQuestion\saveToDb(), assOrderingQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assMultipleChoice\saveToDb(), assClozeTest\saveToDb(), assJavaApplet\saveToDb(), assFormulaQuestion\saveToDb(), and setOriginalId().

◆ $outputType

assQuestion::$outputType
protected

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

Referenced by getOutputType(), and setOutputType().

◆ $owner

◆ $page

assQuestion::$page
protected

◆ $points

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(), assNumeric\getMaximumPoints(), 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().

◆ $prevent_rte_usage

assQuestion::$prevent_rte_usage = false

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

Referenced by getPreventRteUsage().

◆ $processLocker

assQuestion::$processLocker
protected

◆ $question

◆ $questionChangeListeners

assQuestion::$questionChangeListeners = array()
protected

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

Referenced by getQuestionChangeListeners().

◆ $selfassessmenteditingmode

assQuestion::$selfassessmenteditingmode = false

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

Referenced by getSelfAssessmentEditingMode().

◆ $shuffle

◆ $suggested_solutions

assQuestion::$suggested_solutions
protected

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

Referenced by getSuggestedSolutions().

◆ $test_id

◆ $title

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(), assTextQuestion\duplicate(), assFlashQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assMatchingQuestion\duplicate(), assJavaApplet\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), getHtmlUserSolutionPurifier(), getSuggestedSolutionTitle(), getTitle(), questionTitleExists(), and setTitle().

◆ $tpl

assQuestion::$tpl
protected

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

Referenced by __construct(), and __get().

◆ ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT

◆ ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT

const assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'

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