ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjTest Class Reference
+ Inheritance diagram for ilObjTest:
+ Collaboration diagram for ilObjTest:

Public Member Functions

 getLocalDIC ()
 
 getTestLogger ()
 
 getTestLogViewer ()
 
 getQuestionSetConfig ()
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getTmpCopyWizardCopyId ()
 
 setTmpCopyWizardCopyId (int $tmpCopyWizardCopyId)
 
 create ()
 
 update ()
 
 read ()
 
 delete ()
 
 deleteTest ()
 
 createExportDirectory ()
 creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directory that is set in ILIAS setup/ini) More...
 
 getExportDirectory ()
 
 isComplete (ilTestQuestionSetConfig $test_question_set_config)
 
 saveCompleteStatus (ilTestQuestionSetConfig $test_question_set_config)
 
 saveToDb (bool $properties_only=false)
 
 saveQuestionsToDb ()
 
 copyQuestions (array $question_ids)
 
 getNrOfResultsForPass ($active_id, $pass)
 Calculates the number of user results for a specific test pass. More...
 
 loadFromDb ()
 
 loadQuestions (int $active_id=0, ?int $pass=null)
 Load the test question id's from the database. More...
 
 getIntroduction ()
 
 getFinalStatement ()
 
 getTestId ()
 Gets the database id of the additional test data. More...
 
 isPostponingEnabled ()
 
 isScoreReportingEnabled ()
 
 getAnswerFeedbackPoints ()
 
 getGenericAnswerFeedback ()
 
 getInstantFeedbackSolution ()
 
 getCountSystem ()
 
 getScoreCutting ()
 Determines if the score of a question should be cut at 0 points or the score of the whole test. More...
 
 getPassScoring ()
 Gets the pass scoring type. More...
 
 getMarkSchema ()
 
 storeMarkSchema (MarkSchema $mark_schema)
 
 getNrOfTries ()
 
 isBlockPassesAfterPassedEnabled ()
 
 getKioskMode ()
 
 getShowKioskModeTitle ()
 
 getShowKioskModeParticipant ()
 
 getUsePreviousAnswers ()
 
 getTitleOutput ()
 
 isPreviousSolutionReuseEnabled ($active_id)
 
 getProcessingTime ()
 
 getProcessingTimeInSeconds (int $active_id=0)
 
 getEnableProcessingTime ()
 
 getResetProcessingTime ()
 
 isStartingTimeEnabled ()
 
 getStartingTime ()
 
 isEndingTimeEnabled ()
 
 getEndingTime ()
 
 getRedirectionMode ()
 
 isRedirectModeKiosk ()
 
 isRedirectModeNone ()
 
 getRedirectionUrl ()
 
 isPasswordEnabled ()
 
 getPassword ()
 
 removeQuestionsWithResults (array $question_ids)
 
 removeQuestionFromSequences (int $question_id, array $active_ids, ilTestReindexedSequencePositionMap $reindexed_sequence_position_map)
 
 removeQuestions (array $question_ids)
 
 removeQuestion (int $question_id)
 
 removeTestResultsFromSoapLpAdministration (array $user_ids)
 
 removeTestResults (ilTestParticipantData $participant_data)
 
 removeTestResultsByUserIds (array $user_ids)
 
 removeTestActives (array $active_ids)
 
 questionMoveUp ($question_id)
 Moves a question up in order. More...
 
 questionMoveDown ($question_id)
 Moves a question down in order. More...
 
 duplicateQuestionForTest ($question_id)
 Takes a question and creates a copy of the question for use in the test. More...
 
 insertQuestion (int $question_id, bool $link_only=false)
 
 getQuestionTitlesAndIndexes ()
 Returns the titles of the test questions in question sequence. More...
 
 getQuestionTitle ($title, $nr=null, $points=null)
 Returns the title of a test question and checks if the title output is allowed. More...
 
 getQuestionDataset ($question_id)
 Returns the dataset for a given question id. More...
 
getExistingQuestions ($pass=null)
 Get the id's of the questions which are already part of the test. More...
 
 getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 startWorkingTime ($active_id, $pass)
 Write the initial entry for the tests working time to the database. More...
 
 updateWorkingTime ($times_id)
 Update the working time of a test when a question is answered. More...
 
getWorkedQuestions ($active_id, $pass=null)
 Gets the id's of all questions a user already worked through. More...
 
 isTestFinishedToViewResults ($active_id, $currentpass)
 Returns true if an active user completed a test pass and did not start a new pass. More...
 
 getAllQuestions ($pass=null)
 Returns all questions of a test in test order. More...
 
 getActiveIdOfUser ($user_id="", $anonymous_id="")
 Gets the active id of a given user. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getTestResult (int $active_id, ?int $pass=null, bool $ordered_sequence=false, bool $consider_hidden_questions=true, bool $consider_optional_questions=true)
 Calculates the results of a test for a given user and returns an array with all test results. More...
 
 evalTotalPersons ()
 Returns the number of persons who started the test. More...
 
 getCompleteWorkingTime ($user_id)
 Returns the complete working time in seconds a user worked on the test. More...
 
getCompleteWorkingTimeOfParticipants ()
 Returns the complete working time in seconds for all test participants. More...
 
_getCompleteWorkingTimeOfParticipants ($test_id)
 Returns the complete working time in seconds for all test participants. More...
 
 getCompleteWorkingTimeOfParticipant ($active_id)
 Returns the complete working time in seconds for a test participant. More...
 
 getWorkingTimeOfParticipantForPass (int $active_id, int $pass)
 
 evalStatistical ($active_id)
 Returns the statistical evaluation of the test for a specified user. More...
 
 getTotalPointsPassedArray ()
 Returns an array with the total points of all users who passed the test This array could be used for statistics. More...
 
 getParticipants ()
 Returns all persons who started the test. More...
 
 evalTotalPersonsArray (string $name_sort_order='asc')
 
 evalTotalParticipantsArray (string $name_sort_order='asc')
 
 getQuestionsOfTest (int $active_id)
 
 getQuestionsOfPass (int $active_id, int $pass)
 
 getAccessFilteredParticipantList ()
 
 setAccessFilteredParticipantList (ilTestParticipantList $access_filtered_participant_list)
 
 buildStatisticsAccessFilteredParticipantList ()
 
 getUnfilteredEvaluationData ()
 
 getQuestionCountAndPointsForPassOfParticipant (int $active_id, int $pass)
 
 getCompleteEvaluationData ($filterby='', $filtertext='')
 
 buildName (?int $user_id, ?string $firstname, ?string $lastname)
 Builds a user name for the output depending on test type and existence of the user. More...
 
 evalTotalStartedAverageTime (?array $active_ids_to_filter=null)
 
 getAvailableQuestionpools (bool $use_object_id=false, ?bool $equal_points=false, bool $could_be_offline=false, bool $show_path=false, bool $with_questioncount=false, string $permission='read')
 Returns the available question pools for the active user. More...
 
 getImagePath ()
 Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_TEST/images. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a test The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_TEST/images. More...
 
 createQuestionGUI ($question_type, $question_id=-1)
 Creates a question GUI instance of a given question type. More...
 
 moveQuestions (array $move_questions, int $target_index, int $insert_mode)
 
 startingTimeReached ()
 Returns true if the starting time of a test is reached A starting time is not available for self assessment tests. More...
 
 endingTimeReached ()
 Returns true if the ending time of a test is reached An ending time is not available for self assessment tests. More...
 
 getAvailableQuestions ($arr_filter, $completeonly=0)
 Calculates the available questions for a test. More...
 
 fromXML (ilQTIAssessment $assessment, array $mappings)
 Receives parameters from a QTI parser and creates a valid ILIAS test object. More...
 
 toXML ()
 Returns a QTI xml representation of the test. More...
 
 exportPagesXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export pages of test to xml (see ilias_co.dtd) More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 Returns the installation id for a given identifier. More...
 
 exportXMLPageObjects (&$a_xml_writer, $inst, &$expLog)
 export page objects to xml (see ilias_co.dtd) More...
 
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export media objects to xml (see ilias_co.dtd) More...
 
 exportFileItems ($target_dir, &$expLog)
 export files of file itmes More...
 
 getImportMapping ()
 get array of (two) new created questions for import id More...
 
 onMarkSchemaSaved ()
 
 marksEditable ()
 
 saveAuthorToMetadata ($author="")
 Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be called for conversion of "old" tests where the author hasn't been stored in the lifecycle metadata. More...
 
 getAuthor ()
 Gets the authors name of the ilObjTest object. More...
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 Clone object. More...
 
 getQuestionCount ()
 
 getQuestionCountWithoutReloading ()
 
 getTextAnswer ($active_id, $question_id, $pass=null)
 Returns the text answer of a given user for a given question. More...
 
 getQuestiontext ($question_id)
 Returns the question text for a given question. More...
 
 getActiveParticipantList ()
 
getInvitedUsers (int $user_id=0, $order="login, lastname, firstname")
 Returns a list of all invited users in a test. More...
 
 getTestParticipants ()
 
 getTestParticipantsForManualScoring ($filter=null)
 
 getUserData ($ids)
 Returns a data of all users specified by id list. More...
 
 getGroupData ($ids)
 
 getRoleData ($ids)
 
 inviteUser ($user_id, $client_ip="")
 Invites a user to a test. More...
 
 setQuestionSetSolved ($value, $question_id, $user_id)
 sets question solved state to value for given user_id More...
 
 isTestFinished ($active_id)
 returns if the active for user_id has been submitted More...
 
 isActiveTestSubmitted ($user_id=null)
 returns if the active for user_id has been submitted More...
 
 hasNrOfTriesRestriction ()
 returns if the numbers of tries have to be checked More...
 
 isNrOfTriesReached ($tries)
 returns if number of tries are reached More...
 
 getAllTestResults ($participants)
 returns all test results for all participants More...
 
 getAnsweredQuestionCount ($active_id, $pass=null)
 Retrieves the number of answered questions for a given user in a given test. More...
 
 isExecutable ($test_session, $user_id, $allow_pass_increase=false)
 Checks if the test is executable by the given user. More...
 
 isNextPassAllowed (ilTestPassesSelector $testPassesSelector, int &$next_pass_allowed_timestamp)
 
 canShowTestResults (ilTestSession $test_session)
 
 hasAnyTestResult (ilTestSession $test_session)
 
 getStartingTimeOfUser ($active_id, $pass=null)
 Returns the unix timestamp of the time a user started a test. More...
 
 isMaxProcessingTimeReached (int $starting_time, int $active_id)
 Returns whether the maximum processing time for a test is reached or not. More...
 
 getTestQuestions ()
 
 isTestQuestion (int $question_id)
 
 checkQuestionParent (int $question_id)
 
 getFixedQuestionSetTotalPoints ()
 
 getPotentialRandomTestQuestions ()
 
 getShuffleQuestions ()
 
 getListOfQuestionsSettings ()
 Returns the settings for the list of questions options in the test properties This could contain one of the following values: 0 = No list of questions offered 1 = A list of questions is offered 3 = A list of questions is offered and the list of questions is shown as first page of the test 5 = A list of questions is offered and the list of questions is shown as last page of the test 7 = A list of questions is offered and the list of questions is shown as first and last page of the test. More...
 
 getListOfQuestions ()
 
 getUsrPassOverviewEnabled ()
 
 getListOfQuestionsStart ()
 
 getListOfQuestionsEnd ()
 
 getListOfQuestionsDescription ()
 
 getShowPassDetails ()
 Returns if the pass details should be shown when a test is not finished. More...
 
 getShowSolutionPrintview ()
 Returns if the solution printview should be presented to the user or not. More...
 
 canShowSolutionPrintview ($user_id=null)
 
 getShowSolutionFeedback ()
 Returns if the feedback should be presented to the solution or not. More...
 
 getShowSolutionAnswersOnly ()
 Returns if the full solution (including ILIAS content) should be presented to the solution or not. More...
 
 getShowSolutionSignature ()
 Returns if the signature field should be shown in the test results. More...
 
 getShowSolutionSuggested ()
 
 getShowSolutionListComparison ()
 
 getShowSolutionListOwnAnswers ()
 
 _getLastAccess (int $active_id)
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 qtiMaterialToArray ($a_material)
 Reads an QTI material tag and creates a text string. More...
 
 addQTIMaterial (ilXmlWriter &$xml_writer, ?int $page_id, string $material='')
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 getAnonymity ()
 
 getShowCancel ()
 
 getShowMarker ()
 
 getFixedParticipants ()
 
 lookupQuestionSetTypeByActiveId (int $active_id)
 
 userLookupFullName ($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
 Returns the full name of a test user according to the anonymity status. More...
 
 getAvailableDefaults ()
 Returns the available test defaults for the active user. More...
 
 getTestDefaults ($test_defaults_id)
 
 deleteDefaults ($test_default_id)
 
 addDefaults ($a_name)
 Adds the defaults of this test to the test defaults. More...
 
 applyDefaults (array $test_defaults)
 
 processPrintoutput2FO ($print_output)
 Convert a print output to XSL-FO. More...
 
 deliverPDFfromHTML ($content, $title=null)
 Delivers a PDF file from XHTML. More...
 
 deliverPDFfromFO ($fo, $title=null)
 Delivers a PDF file from a XSL-FO string. More...
 
 getCompleteManualFeedback (int $question_id)
 Retrieves the manual feedback for a question in a test. More...
 
 saveManualFeedback (int $active_id, int $question_id, int $pass, ?string $feedback, bool $finalized=false)
 
 getJavaScriptOutput ()
 Returns if Javascript should be chosen for drag & drop actions for the active user. More...
 
createTestSequence ($active_id, $pass, $shuffle)
 
 setTestId ($a_id)
 Sets the test ID. More...
 
 getDetailedTestResults ($participants)
 returns all test results for all participants More...
 
 isPluginActive ($a_pname)
 Checks wheather or not a question plugin with a given name is active. More...
 
 getPassed ($active_id)
 
 getParticipantsForTestAndQuestion ($test_id, $question_id)
 Creates an associated array with all active id's for a given test and original question id. More...
 
 getAggregatedResultsData ()
 
 getXMLZip ()
 Get zipped xml file for test. More...
 
 getMailNotification ()
 
 sendSimpleNotification ($active_id)
 
 sendAdvancedNotification (int $active_id)
 
 getResultsForActiveId (int $active_id)
 
 getMailNotificationType ()
 
 getExportSettings ()
 
 setTemplate (int $template_id)
 
 getTemplate ()
 
 reindexFixedQuestionOrdering ()
 
 setQuestionOrder (array $order)
 
 hasQuestionsWithoutQuestionpool ()
 
 getQuestions ()
 
 isOnline ()
 
 isOfferingQuestionHintsEnabled ()
 
 setActivationVisibility ($a_value)
 
 getActivationVisibility ()
 
 isActivationLimited ()
 
 setActivationLimited ($a_value)
 
 storeActivationSettings (?bool $is_activation_limited=false, ?int $activation_starting_time=null, ?int $activation_ending_time=null, bool $activation_visibility=false,)
 
 getIntroductionPageId ()
 
 getConcludingRemarksPageId ()
 
 getHighscoreEnabled ()
 
 getHighscoreAnon ()
 Gets if the highscores should be anonymized per setting. More...
 
 isHighscoreAnon ()
 Gets if the highscores should be displayed anonymized. More...
 
 getHighscoreAchievedTS ()
 Returns if date and time of the scores achievement should be displayed. More...
 
 getHighscoreScore ()
 Gets if the score column should be shown. More...
 
 getHighscorePercentage ()
 Gets if the percentage column should be shown. More...
 
 getHighscoreHints ()
 Gets, if the column with the number of requested hints should be shown. More...
 
 getHighscoreWTime ()
 Gets if the column with the workingtime should be shown. More...
 
 getHighscoreOwnTable ()
 Gets if the own rankings table should be shown. More...
 
 getHighscoreTopTable ()
 Gets, if the top-rankings table should be shown. More...
 
 getHighscoreTopNum (int $a_retval=10)
 Gets the number of entries which are to be shown in the top-rankings table. More...
 
 getHighscoreMode ()
 
 getSpecificAnswerFeedback ()
 
 getAutosave ()
 
 isPassDeletionAllowed ()
 
 getEnableExamview ()
 
 setActivationStartingTime (?int $starting_time=null)
 
 setActivationEndingTime (?int $ending_time=null)
 
 getActivationStartingTime ()
 
 getActivationEndingTime ()
 
 getStartingTimeOfParticipants ()
 Note, this function should only be used if absolutely necessary, since it perform joins on tables that tend to grow huge and returns vast amount of data. More...
 
 getTimeExtensionsOfParticipants ()
 
 getMaxPassOfTest ()
 
 isShowExamIdInTestPassEnabled ()
 
 isShowExamIdInTestResultsEnabled ()
 
 setQuestionSetType (string $question_set_type)
 
 getQuestionSetType ()
 
 isFixedTest ()
 Returns the fact wether this test is a fixed question set test or not. More...
 
 isRandomTest ()
 Returns the fact wether this test is a random questions test or not. More...
 
 getQuestionSetTypeTranslation (ilLanguage $lng, $questionSetType)
 
 participantDataExist ()
 
 recalculateScores ($preserve_manscoring=false)
 
 isSkillServiceEnabled ()
 
 isSkillServiceToBeConsidered ()
 Returns whether this test must consider skills, usually by providing appropriate extensions in the user interface components. More...
 
 isShowGradingStatusEnabled ()
 
 isShowGradingMarkEnabled ()
 
 isFollowupQuestionAnswerFixationEnabled ()
 
 isInstantFeedbackAnswerFixationEnabled ()
 
 isForceInstantFeedbackEnabled ()
 
 adjustTestSequence ()
 
 getGeneralQuestionPropertiesRepository ()
 
 getGlobalSettings ()
 
 getMainSettings ()
 
 getMainSettingsRepository ()
 
 getScoreSettings ()
 
 getScoreSettingsRepository ()
 
 updateTestResultCache (int $active_id, ?ilAssQuestionProcessLocker $process_locker=null)
 
 updateTestPassResults (int $active_id, int $pass, ?ilAssQuestionProcessLocker $process_locker=null, ?int $test_obj_id=null)
 
 addToNewsOnOnline (bool $old_online_status, bool $new_online_status)
 
 getVisitingTimeOfParticipant (int $active_id)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _createImportDirectory ()
 creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directory that is set in ILIAS setup/ini) More...
 
static _getCountSystem ($active_id)
 
static _getPassScoring (int $active_id)
 Gets the pass scoring type. More...
 
static _getScoreCutting (int $active_id)
 Determines if the score of a question should be cut at 0 points or the score of the whole test. More...
 
static _getActiveIdOfUser ($user_id="", $test_id="")
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _lookupAuthor ($obj_id)
 Gets the authors name of the ilObjTest object. More...
 
static _getAvailableTests ($use_object_id=false)
 Returns the available tests for the active user. More...
 
static _getObjectIDFromTestID ($test_id)
 Returns the ILIAS test object id for a given test id. More...
 
static _getObjectIDFromActiveID ($active_id)
 Returns the ILIAS test object id for a given active id. More...
 
static _getTestIDFromObjectID ($object_id)
 Returns the ILIAS test id for a given object id. More...
 
static _getSolvedQuestions ($active_id, $question_fi=null)
 get solved questions More...
 
static _getPass ($active_id)
 Retrieves the actual pass of a given user for a given test. More...
 
static _getMaxPass ($active_id)
 Retrieves the maximum pass of a given user for a given test in which the user answered at least one question. More...
 
static _getBestPass ($active_id)
 Retrieves the best pass of a given user for a given test. More...
 
static _getResultPass ($active_id)
 Retrieves the pass number that should be counted for a given user. More...
 
static lookupPassResultsUpdateTimestamp ($active_id, $pass)
 
static _getUserIdFromActiveId (int $active_id)
 
static _lookupAnonymity ($a_obj_id)
 
static getManualFeedback (int $active_id, int $question_id, ?int $pass)
 Retrieves the feedback comment for a question in a test if it is finalized. More...
 
static getSingleManualFeedback (int $active_id, int $question_id, int $pass)
 
static _lookupTestObjIdForQuestionId (int $q_id)
 Get test Object ID for question ID. More...
 
static _lookupFinishedUserTests ($a_user_id)
 Gather all finished tests for user. More...
 
static lookupExamId ($active_id, $pass)
 
static buildExamId ($active_id, $pass, $test_obj_id=null)
 
static getTestObjIdsWithActiveForUserId ($userId)
 
static isSkillManagementGloballyActivated ()
 
static isParticipantsLastPassActive (int $test_ref_id, int $user_id)
 
static _lookupRandomTest (int $obj_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

const QUESTION_SET_TYPE_FIXED = 'FIXED_QUEST_SET'
 
const QUESTION_SET_TYPE_RANDOM = 'RANDOM_QUEST_SET'
 
const INVITATION_OFF = 0
 
const INVITATION_ON = 1
 
const SCORE_LAST_PASS = 0
 
const SCORE_BEST_PASS = 1
 
const REDIRECT_NONE = 0
 
const REDIRECT_ALWAYS = 1
 
const REDIRECT_KIOSK = 2
 
int $test_id = -1
 
int $invitation = self::INVITATION_OFF
 
string $author
 
 $metadata
 A reference to an IMS compatible matadata set. More...
 
array $questions = []
 
 $evaluation_data
 Contains the evaluation data settings the tutor defines for the user. More...
 
 $test_sequence = false
 contains the test sequence data More...
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 buildIso8601PeriodForExportCompatibility (DateTimeImmutable $date_time)
 
 buildDateTimeImmutableFromPeriod (?string $period)
 
 doCreateMetaData ()
 
 secondsToHoursMinutesSecondsString (int $seconds)
 
 getHtmlQuestionContentPurifier ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

GeneralQuestionPropertiesRepository $questionrepository
 
bool $print_best_solution_with_result = true
 
bool $activation_visibility = false
 
int $activation_starting_time = null
 
int $activation_ending_time = null
 
ilCtrlInterface $ctrl
 
Refinery $refinery
 
ilSetting $settings
 
ilBenchmark $bench
 
ilTestParticipantAccessFilterFactory $participant_access_filter
 
GlobalSettingsRepository $global_settings_repo
 
MainSettings $main_settings = null
 
MainSettingsRepository $main_settings_repo = null
 
ScoreSettings $score_settings = null
 
ScoreSettingsRepository $score_settings_repo = null
 
TestLogger $logger
 
TestLogViewer $log_viewer
 
ilTestQuestionSetConfigFactory $question_set_config_factory
 
ExportImportFactory $export_factory
 
ilTestParticipantList $access_filtered_participant_list = null
 
ParticipantRepository $participant_repository
 
LOMetadata $lo_metadata
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Private Member Functions

 cloneIntroduction ()
 
 cloneConcludingRemarks ()
 
 clonePage (int $source_page_id)
 
 getProcessingTimeForXML ()
 
 removeQuestionWithResults (int $question_id, TestScoring $scoring)
 
 removeTestResultsByActiveIds (array $active_ids)
 
 getQuestionTitles ()
 
 addIntroductionToSettingsFromImport (SettingsIntroduction $settings, array $material, string $importdir, array $mappings)
 
 addConcludingRemarksToSettingsFromImport (SettingsFinishing $settings, array $material, string $importdir, array $mappings)
 
 replaceMobsInPageImports (string $text, array $mappings)
 
 replaceFilesInPageImports (string $text, array $mappings)
 
 retrieveMobsFromLegacyImports (string $text, array $mobs, string $importdir)
 
 convertTimeToDateTimeImmutableIfNecessary (DateTimeImmutable|int|null $date_time)
 
 insertManualFeedback (int $active_id, int $question_id, int $pass, ?string $feedback, bool $finalized, array $feedback_old)
 
 getExtraTime (int $active_id)
 

Private Attributes

bool $activation_limited = null
 
array $mob_ids
 
array $file_ids = []
 
bool $online
 
RequestDataCollector $testrequest
 
MarksRepository $marks_repository
 
MarkSchema $mark_schema = null
 
int $template_id = 0
 
 $participantDataExist = null
 holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilObjTest::paricipantDataExist() since this method initialises this property More...
 
int $tmpCopyWizardCopyId = null
 
TestManScoringDoneHelper $test_man_scoring_done_helper
 
ilComponentRepository $component_repository
 
ilComponentFactory $component_factory
 
Filesystem $filesystem_web
 

Static Private Attributes

static $isSkillManagementGloballyActivated = null
 

Detailed Description

Definition at line 64 of file class.ilObjTest.php.

Member Function Documentation

◆ _createImportDirectory()

static ilObjTest::_createImportDirectory ( )
static

creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directory that is set in ILIAS setup/ini)

Definition at line 400 of file class.ilObjTest.php.

References $DIC, ilObject\$ilias, ilFileUtils\delDir(), ilFileUtils\getDataDir(), ilFileUtils\makeDir(), and ILIAS\raiseError().

400  : string
401  {
402  global $DIC;
403  $ilias = $DIC['ilias'];
404  $tst_data_dir = ilFileUtils::getDataDir() . "/tst_data";
405  ilFileUtils::makeDir($tst_data_dir);
406 
407  if (!is_writable($tst_data_dir)) {
408  $ilias->raiseError("Test Data Directory (" . $tst_data_dir
409  . ") not writeable.", $ilias->error_obj->FATAL);
410  }
411 
412  // create test directory (data_dir/tst_data/tst_import)
413  $tst_dir = $tst_data_dir . "/tst_import";
414  ilFileUtils::makeDir($tst_dir);
415  if (!@is_dir($tst_dir)) {
416  $ilias->raiseError("Creation of test import directory failed.", $ilias->error_obj->FATAL);
417  }
418 
419  // assert that this is empty and does not contain old data
420  ilFileUtils::delDir($tst_dir, true);
421 
422  return $tst_dir;
423  }
raiseError(string $a_msg, int $a_err_obj)
wrapper for downward compability
ILIAS $ilias
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
global $DIC
Definition: shib_login.php:22
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ _getActiveIdOfUser()

static ilObjTest::_getActiveIdOfUser (   $user_id = "",
  $test_id = "" 
)
static

Definition at line 1740 of file class.ilObjTest.php.

References $DIC, $ilDB, and $user_id.

Referenced by ilLOUtils\getTestResultLinkForUser().

1741  {
1742  global $DIC;
1743  $ilDB = $DIC['ilDB'];
1744  $ilUser = $DIC['ilUser'];
1745 
1746  if (!$user_id) {
1747  $user_id = $ilUser->id;
1748  }
1749  if (!$test_id) {
1750  return "";
1751  }
1752  $result = $ilDB->queryF(
1753  "SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
1754  ['integer', 'integer'],
1755  [$user_id, $test_id]
1756  );
1757  if ($result->numRows()) {
1758  $row = $ilDB->fetchAssoc($result);
1759  return $row["active_id"];
1760  } else {
1761  return "";
1762  }
1763  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getAvailableTests()

static ilObjTest::_getAvailableTests (   $use_object_id = false)
static

Returns the available tests for the active user.

Returns
array The available tests public

Definition at line 4092 of file class.ilObjTest.php.

References $DIC, ilObject\$ref_id, ilUtil\_getObjectsByOperations(), ilObject\_lookupObjId(), and ilObject\_prepareCloneSelection().

4092  : array
4093  {
4094  global $DIC;
4095  $ilUser = $DIC['ilUser'];
4096 
4097  $result_array = [];
4098  $tests = array_slice(
4099  array_reverse(
4100  ilUtil::_getObjectsByOperations("tst", "write", $ilUser->getId(), PHP_INT_MAX)
4101  ),
4102  0,
4103  10000
4104  );
4105 
4106  if (count($tests)) {
4107  $titles = ilObject::_prepareCloneSelection($tests, "tst");
4108  foreach ($tests as $ref_id) {
4109  if ($use_object_id) {
4110  $obj_id = ilObject::_lookupObjId($ref_id);
4111  $result_array[$obj_id] = $titles[$ref_id];
4112  } else {
4113  $result_array[$ref_id] = $titles[$ref_id];
4114  }
4115  }
4116  }
4117  return $result_array;
4118  }
static _lookupObjId(int $ref_id)
static _prepareCloneSelection(array $ref_ids, string $new_type, bool $show_path=true)
Prepare copy wizard object selection.
global $DIC
Definition: shib_login.php:22
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
+ Here is the call graph for this function:

◆ _getBestPass()

static ilObjTest::_getBestPass (   $active_id)
static

Retrieves the best pass of a given user for a given test.

Parameters
int$active_id
Returns
int|mixed

Definition at line 4836 of file class.ilObjTest.php.

References $DIC, $ilDB, and null.

Referenced by _getResultPass().

4836  : ?int
4837  {
4838  global $DIC;
4839  $ilDB = $DIC['ilDB'];
4840 
4841  $result = $ilDB->queryF(
4842  "SELECT * FROM tst_pass_result WHERE active_fi = %s",
4843  ['integer'],
4844  [$active_id]
4845  );
4846 
4847  if (!$result->numRows()) {
4848  return null;
4849  }
4850 
4851  $bestrow = null;
4852  $bestfactor = 0.0;
4853  while ($row = $ilDB->fetchAssoc($result)) {
4854  if ($row["maxpoints"] > 0.0) {
4855  $factor = (float) ($row["points"] / $row["maxpoints"]);
4856  } else {
4857  $factor = 0.0;
4858  }
4859  if ($factor === 0.0 && $bestfactor === 0.0
4860  || $factor > $bestfactor) {
4861  $bestrow = $row;
4862  $bestfactor = $factor;
4863  }
4864  }
4865 
4866  if (is_array($bestrow)) {
4867  return $bestrow["pass"];
4868  }
4869 
4870  return null;
4871  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getCompleteWorkingTimeOfParticipants()

& ilObjTest::_getCompleteWorkingTimeOfParticipants (   $test_id)

Returns the complete working time in seconds for all test participants.

Parameters
integer$test_idThe database ID of the test
Returns
array An array containing the working time in seconds for all test participants public

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

Referenced by getCompleteWorkingTimeOfParticipants().

2040  : array
2041  {
2042  $result = $this->db->queryF(
2043  "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.active_fi, tst_times.started",
2044  ['integer'],
2045  [$test_id]
2046  );
2047  $time = 0;
2048  $times = [];
2049  while ($row = $this->db->fetchAssoc($result)) {
2050  if (!array_key_exists($row["active_fi"], $times)) {
2051  $times[$row["active_fi"]] = 0;
2052  }
2053  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
2054  $epoch_1 = mktime(
2055  (int) $matches[4],
2056  (int) $matches[5],
2057  (int) $matches[6],
2058  (int) $matches[2],
2059  (int) $matches[3],
2060  (int) $matches[1]
2061  );
2062  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
2063  $epoch_2 = mktime(
2064  (int) $matches[4],
2065  (int) $matches[5],
2066  (int) $matches[6],
2067  (int) $matches[2],
2068  (int) $matches[3],
2069  (int) $matches[1]
2070  );
2071  $times[$row["active_fi"]] += ($epoch_2 - $epoch_1);
2072  }
2073  return $times;
2074  }
+ Here is the caller graph for this function:

◆ _getCountSystem()

static ilObjTest::_getCountSystem (   $active_id)
static

Definition at line 766 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by assQuestion\adjustReachedPointsByScoringOptions().

767  {
768  global $DIC;
769  $ilDB = $DIC['ilDB'];
770  $result = $ilDB->queryF(
771  "SELECT tst_tests.count_system FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
772  ['integer'],
773  [$active_id]
774  );
775  if ($result->numRows()) {
776  $row = $ilDB->fetchAssoc($result);
777  return $row["count_system"];
778  }
779  return false;
780  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getLastAccess()

ilObjTest::_getLastAccess ( int  $active_id)

Definition at line 5386 of file class.ilObjTest.php.

References $DIC, $ilDB, $res, and null.

5386  : string
5387  {
5388  $result = $this->db->queryF(
5389  "SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
5390  ['integer'],
5391  [$active_id]
5392  );
5393  if ($result->numRows()) {
5394  $row = $this->db->fetchAssoc($result);
5395  return $row["finished"];
5396  }
5397  return "";
5398  }

◆ _getMaxPass()

static ilObjTest::_getMaxPass (   $active_id)
static

Retrieves the maximum pass of a given user for a given test in which the user answered at least one question.

Parameters
integer$user_idThe user id
integer$test_idThe test id
Returns
integer The pass of the user for the given test public

Definition at line 4813 of file class.ilObjTest.php.

References $DIC, $ilDB, and null.

Referenced by _getResultPass(), and ilTestParticipantList\lookupNrOfTries().

4813  : ?int
4814  {
4815  global $DIC;
4816  $ilDB = $DIC['ilDB'];
4817  $result = $ilDB->queryF(
4818  "SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
4819  ['integer'],
4820  [$active_id]
4821  );
4822 
4823  if ($result->numRows()) {
4824  $row = $ilDB->fetchAssoc($result);
4825  return $row["maxpass"];
4826  }
4827 
4828  return null;
4829  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getObjectIDFromActiveID()

static ilObjTest::_getObjectIDFromActiveID (   $active_id)
static

Returns the ILIAS test object id for a given active id.

Parameters
integer$active_idThe active id
Returns
mixed The ILIAS test object id or FALSE if the query was not successful public

Definition at line 4276 of file class.ilObjTest.php.

References $DIC, and $ilDB.

4277  {
4278  global $DIC;
4279  $ilDB = $DIC['ilDB'];
4280  $object_id = false;
4281  $result = $ilDB->queryF(
4282  "SELECT tst_tests.obj_fi FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
4283  ['integer'],
4284  [$active_id]
4285  );
4286  if ($result->numRows()) {
4287  $row = $ilDB->fetchAssoc($result);
4288  $object_id = $row["obj_fi"];
4289  }
4290  return $object_id;
4291  }
global $DIC
Definition: shib_login.php:22

◆ _getObjectIDFromTestID()

static ilObjTest::_getObjectIDFromTestID (   $test_id)
static

Returns the ILIAS test object id for a given test id.

Parameters
integer$test_idThe test id
Returns
mixed The ILIAS test object id or FALSE if the query was not successful public

Definition at line 4252 of file class.ilObjTest.php.

References $DIC, and $ilDB.

4253  {
4254  global $DIC;
4255  $ilDB = $DIC['ilDB'];
4256  $object_id = false;
4257  $result = $ilDB->queryF(
4258  "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
4259  ['integer'],
4260  [$test_id]
4261  );
4262  if ($result->numRows()) {
4263  $row = $ilDB->fetchAssoc($result);
4264  $object_id = $row["obj_fi"];
4265  }
4266  return $object_id;
4267  }
global $DIC
Definition: shib_login.php:22

◆ _getPass()

static ilObjTest::_getPass (   $active_id)
static

Retrieves the actual pass of a given user for a given test.

Parameters
integer$user_idThe user id
integer$test_idThe test id
Returns
integer The pass of the user for the given test public

Definition at line 4787 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by ilTestService\getPassOverviewData(), assFormulaQuestionGUI\getTestOutput(), assQuestion\persistWorkingState(), ilTestPlayerAbstractGUI\populateInstantResponseBlocks(), ilTestPlayerAbstractGUI\save(), assOrderingHorizontal\saveWorkingData(), assNumeric\saveWorkingData(), assErrorText\saveWorkingData(), assSingleChoice\saveWorkingData(), assTextSubset\saveWorkingData(), assKprimChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), assMultipleChoice\saveWorkingData(), assFileUpload\saveWorkingData(), assLongMenu\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assFormulaQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), and assClozeTest\saveWorkingData().

4787  : int
4788  {
4789  global $DIC;
4790  $ilDB = $DIC['ilDB'];
4791  $result = $ilDB->queryF(
4792  "SELECT tries FROM tst_active WHERE active_id = %s",
4793  ['integer'],
4794  [$active_id]
4795  );
4796  if ($result->numRows()) {
4797  $row = $ilDB->fetchAssoc($result);
4798  return $row["tries"];
4799  } else {
4800  return 0;
4801  }
4802  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getPassScoring()

static ilObjTest::_getPassScoring ( int  $active_id)
static

Gets the pass scoring type.

Definition at line 801 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by _getResultPass().

801  : int
802  {
803  global $DIC;
804  $ilDB = $DIC['ilDB'];
805  $result = $ilDB->queryF(
806  "SELECT tst_tests.pass_scoring FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
807  ['integer'],
808  [$active_id]
809  );
810  if ($result->numRows()) {
811  $row = $ilDB->fetchAssoc($result);
812  return (int) $row["pass_scoring"];
813  }
814  return 0;
815  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getResultPass()

static ilObjTest::_getResultPass (   $active_id)
static

Retrieves the pass number that should be counted for a given user.

Parameters
integer$user_idThe user id
integer$test_idThe test id
Returns
integer The result pass of the user for the given test public

Definition at line 4881 of file class.ilObjTest.php.

References _getBestPass(), _getMaxPass(), _getPassScoring(), and null.

Referenced by ILIAS\Test\Questions\Presentation\Printer\addQuestionResultForTestUsersToTemplate(), ilTestArchiver\createUserResultsForArchive(), evalStatistical(), getAllTestResults(), getDetailedTestResults(), getPassed(), ilTestServiceGUI\getPassOverviewTableData(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\performDeletePass(), ilTestEvaluationGUI\printResults(), ilTestEvaluationGUI\showResults(), and updateTestResultCache().

4881  : ?int
4882  {
4883  $counted_pass = null;
4884  if (ilObjTest::_getPassScoring($active_id) == self::SCORE_BEST_PASS) {
4885  $counted_pass = ilObjTest::_getBestPass($active_id);
4886  } else {
4887  $counted_pass = ilObjTest::_getMaxPass($active_id);
4888  }
4889  return $counted_pass;
4890  }
static _getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
static _getPassScoring(int $active_id)
Gets the pass scoring type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getScoreCutting()

static ilObjTest::_getScoreCutting ( int  $active_id)
static

Determines if the score of a question should be cut at 0 points or the score of the whole test.

Definition at line 820 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by assQuestion\adjustReachedPointsByScoringOptions().

820  : bool
821  {
822  global $DIC;
823  $ilDB = $DIC['ilDB'];
824  $result = $ilDB->queryF(
825  "SELECT tst_tests.score_cutting FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
826  ['integer'],
827  [$active_id]
828  );
829  if ($result->numRows()) {
830  $row = $ilDB->fetchAssoc($result);
831  return (bool) $row["score_cutting"];
832  }
833  return false;
834  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getSolvedQuestions()

static ilObjTest::_getSolvedQuestions (   $active_id,
  $question_fi = null 
)
static

get solved questions

Returns
array of int containing all question ids which have been set solved for the given user and test

Definition at line 4611 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by ilTestPlayerAbstractGUI\buildEditableStateQuestionNavigationGUI(), ilTestPlayerAbstractGUI\buildReadOnlyStateQuestionNavigationGUI(), ilTestService\getQuestionSummaryData(), and ilTestSequence\getSequenceSummary().

4611  : array
4612  {
4613  global $DIC;
4614  $ilDB = $DIC['ilDB'];
4615  if (is_numeric($question_fi)) {
4616  $result = $ilDB->queryF(
4617  "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
4618  ['integer', 'integer'],
4619  [$active_id, $question_fi]
4620  );
4621  } else {
4622  $result = $ilDB->queryF(
4623  "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
4624  ['integer'],
4625  [$active_id]
4626  );
4627  }
4628  $result_array = [];
4629  while ($row = $ilDB->fetchAssoc($result)) {
4630  $result_array[$row["question_fi"]] = $row;
4631  }
4632  return $result_array;
4633  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getTestIDFromObjectID()

static ilObjTest::_getTestIDFromObjectID (   $object_id)
static

Returns the ILIAS test id for a given object id.

Parameters
integer$object_idThe object id
Returns
mixed The ILIAS test id or FALSE if the query was not successful public

Definition at line 4300 of file class.ilObjTest.php.

References $DIC, $ilDB, and $test_id.

Referenced by ilLOUtils\getTestResultLinkForUser(), and ilTestAccess\isParticipantAllowed().

4301  {
4302  global $DIC;
4303  $ilDB = $DIC['ilDB'];
4304  $test_id = false;
4305  $result = $ilDB->queryF(
4306  "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
4307  ['integer'],
4308  [$object_id]
4309  );
4310  if ($result->numRows()) {
4311  $row = $ilDB->fetchAssoc($result);
4312  $test_id = $row["test_id"];
4313  }
4314  return $test_id;
4315  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getUserIdFromActiveId()

static ilObjTest::_getUserIdFromActiveId ( int  $active_id)
static
Deprecated:
: use ilTestParticipantData instead

Definition at line 5369 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by assQuestion\_setReachedPoints(), sendAdvancedNotification(), sendSimpleNotification(), and ILIAS\Test\ExportImport\CertificateExport\write().

5369  : int
5370  {
5371  global $DIC;
5372  $ilDB = $DIC['ilDB'];
5373  $result = $ilDB->queryF(
5374  "SELECT user_fi FROM tst_active WHERE active_id = %s",
5375  ['integer'],
5376  [$active_id]
5377  );
5378  if ($result->numRows()) {
5379  $row = $ilDB->fetchAssoc($result);
5380  return $row["user_fi"];
5381  } else {
5382  return -1;
5383  }
5384  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _instanciateQuestion()

static ilObjTest::_instanciateQuestion (   $question_id)
static

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

Parameters
int$question_idThe question id
Exceptions
InvalidArgumentException
Deprecated:
use assQuestion::_instanciateQuestion($question_id) instead

Definition at line 2715 of file class.ilObjTest.php.

References assQuestion\instantiateQuestion(), and null.

Referenced by ilCourseObjectiveQuestion\__read(), duplicateQuestionForTest(), getAllTestResults(), getDetailedTestResults(), ilCourseObjectiveQuestion\getMaxPointsByObjective(), ilCourseObjectiveQuestion\getMaxPointsByTest(), and ilCourseObjectiveQuestionAssignmentTableGUI\parse().

2715  : ?assQuestion
2716  {
2717  if (strcmp((string) $question_id, "") !== 0) {
2718  return assQuestion::instantiateQuestion((int) $question_id);
2719  }
2720 
2721  return null;
2722  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static instantiateQuestion(int $question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupAnonymity()

static ilObjTest::_lookupAnonymity (   $a_obj_id)
static

Definition at line 5548 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by ilObjTestAccess\_getParticipantData().

5548  : int
5549  {
5550  global $DIC;
5551  $ilDB = $DIC['ilDB'];
5552 
5553  $result = $ilDB->queryF(
5554  "SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
5555  ['integer'],
5556  [$a_obj_id]
5557  );
5558  while ($row = $ilDB->fetchAssoc($result)) {
5559  return (int) $row['anonymity'];
5560  }
5561  return 0;
5562  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupAuthor()

static ilObjTest::_lookupAuthor (   $obj_id)
static

Gets the authors name of the ilObjTest object.

Returns
string The string containing the name of the test author public
See also
$author

Definition at line 4073 of file class.ilObjTest.php.

References $DIC.

Referenced by assQuestion\getInstances().

4073  : string
4074  {
4075  global $DIC;
4076 
4077  $lo_metadata = $DIC->learningObjectMetadata();
4078 
4079  $path_to_authors = $lo_metadata->paths()->authors();
4080  $author_data = $lo_metadata->read($obj_id, 0, "tst", $path_to_authors)
4081  ->allData($path_to_authors);
4082 
4083  return $lo_metadata->dataHelper()->makePresentableAsList(',', ...$author_data);
4084  }
global $DIC
Definition: shib_login.php:22
LOMetadata $lo_metadata
+ Here is the caller graph for this function:

◆ _lookupFinishedUserTests()

static ilObjTest::_lookupFinishedUserTests (   $a_user_id)
static

Gather all finished tests for user.

Parameters
int$a_user_id
Returns
array(test id => passed)

Definition at line 6658 of file class.ilObjTest.php.

References $DIC, and $ilDB.

6658  : array
6659  {
6660  global $DIC;
6661  $ilDB = $DIC['ilDB'];
6662 
6663  $result = $ilDB->queryF(
6664  "SELECT test_fi,MAX(pass) AS pass FROM tst_active" .
6665  " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)" .
6666  " WHERE user_fi=%s" .
6667  " GROUP BY test_fi",
6668  ['integer', 'integer'],
6669  [$a_user_id, 1]
6670  );
6671  $all = [];
6672  while ($row = $ilDB->fetchAssoc($result)) {
6673  $obj_id = self::_getObjectIDFromTestID($row["test_fi"]);
6674  $all[$obj_id] = (bool) $row["pass"];
6675  }
6676  return $all;
6677  }
global $DIC
Definition: shib_login.php:22

◆ _lookupRandomTest()

static ilObjTest::_lookupRandomTest ( int  $obj_id)
static
Deprecated:
There is no reason for this to be interesting for other objects

Definition at line 7554 of file class.ilObjTest.php.

References $DIC, $res, and null.

Referenced by ilLOSettings\isRandomTestType(), ilCourseObjectivesGUI\isRandomTestType(), and ilLOUtils\lookupRandomTest().

7554  : bool
7555  {
7556  global $DIC;
7557 
7558  $query = 'SELECT question_set_type FROM tst_tests WHERE obj_fi = %s';
7559 
7560  $res = $DIC['ilDB']->queryF($query, ['integer'], [$obj_id]);
7561 
7562  $question_set_type = null;
7563 
7564  while ($row = $DIC['ilDB']->fetchAssoc($res)) {
7565  $question_set_type = $row['question_set_type'];
7566  }
7567 
7568  return $question_set_type === self::QUESTION_SET_TYPE_RANDOM;
7569  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupTestObjIdForQuestionId()

static ilObjTest::_lookupTestObjIdForQuestionId ( int  $q_id)
static

Get test Object ID for question ID.

Definition at line 6304 of file class.ilObjTest.php.

References $DIC, $ilDB, and null.

Referenced by assQuestion\_setReachedPoints(), and ilObjMediaObject\getParentObjectIdForUsage().

6304  : ?int
6305  {
6306  global $DIC;
6307  $ilDB = $DIC['ilDB'];
6308 
6309  $result = $ilDB->queryF(
6310  'SELECT t.obj_fi obj_id FROM tst_test_question q, tst_tests t WHERE q.test_fi = t.test_id AND q.question_fi = %s',
6311  ['integer'],
6312  [$q_id]
6313  );
6314  $rec = $ilDB->fetchAssoc($result);
6315  return $rec['obj_id'] ?? null;
6316  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ addConcludingRemarksToSettingsFromImport()

ilObjTest::addConcludingRemarksToSettingsFromImport ( SettingsFinishing  $settings,
array  $material,
string  $importdir,
array  $mappings 
)
private

Definition at line 3274 of file class.ilObjTest.php.

References ilSession\get(), ILIAS\Test\Settings\MainSettings\SettingsFinishing\getAlwaysSendMailNotification(), ilObject\getId(), ILIAS\Test\Settings\MainSettings\SettingsFinishing\getMailNotificationContentType(), ILIAS\Test\Settings\MainSettings\SettingsFinishing\getRedirectionMode(), ILIAS\Test\Settings\MainSettings\SettingsFinishing\getRedirectionUrl(), ILIAS\Test\Settings\MainSettings\SettingsFinishing\getShowAnswerOverview(), ILIAS\Test\Settings\TestSettings\getTestId(), null, replaceFilesInPageImports(), replaceMobsInPageImports(), retrieveMobsFromLegacyImports(), and ILIAS\Test\Settings\MainSettings\SettingsFinishing\withConcludingRemarksPageId().

Referenced by fromXML().

3279  : SettingsFinishing {
3280  $file_to_import = ilSession::get('path_to_import_file');
3281  $text = $material['text'];
3282  $mobs = $material['mobs'];
3283  if (str_starts_with($text, '<PageObject>')) {
3284  $text = $this->replaceMobsInPageImports(
3285  $text,
3286  $mappings['components/ILIAS/MediaObjects']['mob'] ?? []
3287  );
3288  $text = $this->replaceFilesInPageImports(
3289  $text,
3290  $mappings['components/ILIAS/File']['file'] ?? []
3291  );
3292  $page_object = new ilTestPage();
3293  $page_object->setParentId($this->getId());
3294  $page_object->setXMLContent($text);
3295  $new_page_id = $page_object->createPageWithNextId();
3296  return $settings->withConcludingRemarksPageId($new_page_id);
3297  }
3298 
3299  $text = $this->retrieveMobsFromLegacyImports($text, $mobs, $importdir);
3300 
3301  return new SettingsFinishing(
3302  $settings->getTestId(),
3303  $settings->getShowAnswerOverview(),
3304  strlen($text) > 0,
3305  $text,
3306  null,
3307  $settings->getRedirectionMode(),
3308  $settings->getRedirectionUrl(),
3309  $settings->getMailNotificationContentType(),
3310  $settings->getAlwaysSendMailNotification()
3311  );
3312  }
replaceFilesInPageImports(string $text, array $mappings)
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
replaceMobsInPageImports(string $text, array $mappings)
retrieveMobsFromLegacyImports(string $text, array $mobs, string $importdir)
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
withConcludingRemarksPageId(?int $concluding_remarks_page_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDefaults()

ilObjTest::addDefaults (   $a_name)

Adds the defaults of this test to the test defaults.

Parameters
string$a_nameThe name of the test defaults public

Definition at line 5674 of file class.ilObjTest.php.

References ILIAS\Test\Settings\MainSettings\MainSettings\getAccessSettings(), getActivationEndingTime(), getActivationStartingTime(), getActivationVisibility(), ILIAS\Test\Settings\MainSettings\MainSettings\getAdditionalSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getFinishingSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getGamificationSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getGeneralSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getIntroductionSettings(), getMainSettings(), getMarkSchema(), ILIAS\Test\Scoring\Marks\Mark\getMinimumLevel(), ILIAS\Test\Scoring\Marks\Mark\getOfficialName(), ILIAS\Test\Settings\MainSettings\MainSettings\getParticipantFunctionalitySettings(), ILIAS\Test\Scoring\Marks\Mark\getPassed(), ILIAS\Test\Settings\MainSettings\MainSettings\getQuestionBehaviourSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultDetailsSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultSummarySettings(), getScoreSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getScoringSettings(), ILIAS\Test\Scoring\Marks\Mark\getShortName(), ILIAS\Test\Settings\MainSettings\MainSettings\getTestBehaviourSettings(), ILIAS\Repository\int(), isActivationLimited(), and ILIAS\Repository\user().

5675  {
5676  $main_settings = $this->getMainSettings();
5677  $score_settings = $this->getScoreSettings();
5678  $testsettings = [
5679  'questionSetType' => $main_settings->getGeneralSettings()->getQuestionSetType(),
5680  'Anonymity' => (int) $main_settings->getGeneralSettings()->getAnonymity(),
5681 
5682  'activation_limited' => $this->isActivationLimited(),
5683  'activation_start_time' => $this->getActivationStartingTime(),
5684  'activation_end_time' => $this->getActivationEndingTime(),
5685  'activation_visibility' => $this->getActivationVisibility(),
5686 
5687  'IntroEnabled' => (int) $main_settings->getIntroductionSettings()->getIntroductionEnabled(),
5688  'ExamConditionsCheckboxEnabled' => (int) $main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled(),
5689 
5690  'StartingTimeEnabled' => (int) $main_settings->getAccessSettings()->getStartTimeEnabled(),
5691  'StartingTime' => $main_settings->getAccessSettings()->getStartTime(),
5692  'EndingTimeEnabled' => (int) $main_settings->getAccessSettings()->getEndTimeEnabled(),
5693  'EndingTime' => $main_settings->getAccessSettings()->getEndTime(),
5694  'password_enabled' => (int) $main_settings->getAccessSettings()->getPasswordEnabled(),
5695  'password' => $main_settings->getAccessSettings()->getPassword(),
5696  'fixed_participants' => (int) $main_settings->getAccessSettings()->getFixedParticipants(),
5697 
5698  'NrOfTries' => $main_settings->getTestBehaviourSettings()->getNumberOfTries(),
5699  'BlockAfterPassed' => (int) $main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled(),
5700  'pass_waiting' => $main_settings->getTestBehaviourSettings()->getPassWaiting(),
5701  'EnableProcessingTime' => (int) $main_settings->getTestBehaviourSettings()->getProcessingTimeEnabled(),
5702  'ProcessingTime' => $main_settings->getTestBehaviourSettings()->getProcessingTime(),
5703  'ResetProcessingTime' => $main_settings->getTestBehaviourSettings()->getResetProcessingTime(),
5704  'Kiosk' => $main_settings->getTestBehaviourSettings()->getKioskMode(),
5705  'examid_in_test_pass' => (int) $main_settings->getTestBehaviourSettings()->getExamIdInTestAttemptEnabled(),
5706 
5707  'TitleOutput' => $main_settings->getQuestionBehaviourSettings()->getQuestionTitleOutputMode(),
5708  'autosave' => (int) $main_settings->getQuestionBehaviourSettings()->getAutosaveEnabled(),
5709  'autosave_ival' => $main_settings->getQuestionBehaviourSettings()->getAutosaveInterval(),
5710  'Shuffle' => (int) $main_settings->getQuestionBehaviourSettings()->getShuffleQuestions(),
5711  'offer_question_hints' => (int) $main_settings->getQuestionBehaviourSettings()->getQuestionHintsEnabled(),
5712  'AnswerFeedbackPoints' => (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackPointsEnabled(),
5713  'AnswerFeedback' => (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackGenericEnabled(),
5714  'SpecificAnswerFeedback' => (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackSpecificEnabled(),
5715  'InstantFeedbackSolution' => (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackSolutionEnabled(),
5716  'force_inst_fb' => (int) $main_settings->getQuestionBehaviourSettings()->getForceInstantFeedbackOnNextQuestion(),
5717  'follow_qst_answer_fixation' => (int) $main_settings->getQuestionBehaviourSettings()->getLockAnswerOnNextQuestionEnabled(),
5718  'inst_fb_answer_fixation' => (int) $main_settings->getQuestionBehaviourSettings()->getLockAnswerOnInstantFeedbackEnabled(),
5719 
5720  'use_previous_answers' => (int) $main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed(),
5721  'ShowCancel' => (int) $main_settings->getParticipantFunctionalitySettings()->getSuspendTestAllowed(),
5722  'SequenceSettings' => (int) $main_settings->getParticipantFunctionalitySettings()->getPostponedQuestionsMoveToEnd(),
5723  'ListOfQuestionsSettings' => $main_settings->getParticipantFunctionalitySettings()->getUsrPassOverviewMode(),
5724  'ShowMarker' => (int) $main_settings->getParticipantFunctionalitySettings()->getQuestionMarkingEnabled(),
5725 
5726  'enable_examview' => $main_settings->getFinishingSettings()->getShowAnswerOverview(),
5727  'ShowFinalStatement' => (int) $main_settings->getFinishingSettings()->getConcludingRemarksEnabled(),
5728  'redirection_mode' => $main_settings->getFinishingSettings()->getRedirectionMode(),
5729  'redirection_url' => $main_settings->getFinishingSettings()->getRedirectionUrl(),
5730  'mailnotification' => $main_settings->getFinishingSettings()->getMailNotificationContentType(),
5731  'mailnottype' => (int) $main_settings->getFinishingSettings()->getAlwaysSendMailNotification(),
5732 
5733  'skill_service' => (int) $main_settings->getAdditionalSettings()->getSkillsServiceEnabled(),
5734 
5735  'PassScoring' => $score_settings->getScoringSettings()->getPassScoring(),
5736  'ScoreCutting' => $score_settings->getScoringSettings()->getScoreCutting(),
5737  'CountSystem' => $score_settings->getScoringSettings()->getCountSystem(),
5738 
5739  'ScoreReporting' => $score_settings->getResultSummarySettings()->getScoreReporting()->value,
5740  'ReportingDate' => $score_settings->getResultSummarySettings()->getReportingDate(),
5741  'pass_deletion_allowed' => (int) $score_settings->getResultSummarySettings()->getPassDeletionAllowed(),
5742  'show_grading_status' => (int) $score_settings->getResultSummarySettings()->getShowGradingStatusEnabled(),
5743  'show_grading_mark' => (int) $score_settings->getResultSummarySettings()->getShowGradingMarkEnabled(),
5744 
5745  'ResultsPresentation' => $score_settings->getResultDetailsSettings()->getResultsPresentation(),
5746  'show_solution_list_comparison' => (int) $score_settings->getResultDetailsSettings()->getShowSolutionListComparison(),
5747  'examid_in_test_res' => (int) $score_settings->getResultDetailsSettings()->getShowExamIdInTestResults(),
5748 
5749  'highscore_enabled' => (int) $score_settings->getGamificationSettings()->getHighscoreEnabled(),
5750  'highscore_anon' => (int) $score_settings->getGamificationSettings()->getHighscoreAnon(),
5751  'highscore_achieved_ts' => $score_settings->getGamificationSettings()->getHighscoreAchievedTS(),
5752  'highscore_score' => $score_settings->getGamificationSettings()->getHighscoreScore(),
5753  'highscore_percentage' => $score_settings->getGamificationSettings()->getHighscorePercentage(),
5754  'highscore_hints' => $score_settings->getGamificationSettings()->getHighscoreHints(),
5755  'highscore_wtime' => $score_settings->getGamificationSettings()->getHighscoreWTime(),
5756  'highscore_own_table' => $score_settings->getGamificationSettings()->getHighscoreOwnTable(),
5757  'highscore_top_table' => $score_settings->getGamificationSettings()->getHighscoreTopTable(),
5758  'highscore_top_num' => $score_settings->getGamificationSettings()->getHighscoreTopNum(),
5759 
5760  'HideInfoTab' => (int) $main_settings->getAdditionalSettings()->getHideInfoTab(),
5761  ];
5762 
5763  $marks = array_map(
5764  fn(Mark $v): array => [
5765  'short_name' => $v->getShortName(),
5766  'official_name' => $v->getOfficialName(),
5767  'minimum_level' => $v->getMinimumLevel(),
5768  'passed' => $v->getPassed()
5769  ],
5770  $this->getMarkSchema()->getMarkSteps()
5771  );
5772 
5773  $next_id = $this->db->nextId('tst_test_defaults');
5774  $this->db->insert(
5775  'tst_test_defaults',
5776  [
5777  'test_defaults_id' => ['integer', $next_id],
5778  'name' => ['text', $a_name],
5779  'user_fi' => ['integer', $this->user->getId()],
5780  'defaults' => ['clob', serialize($testsettings)],
5781  'marks' => ['clob', json_encode($marks)],
5782  'tstamp' => ['integer', time()]
5783  ]
5784  );
5785  }
A class defining marks for assessment test objects.
Definition: Mark.php:35
MainSettings $main_settings
ScoreSettings $score_settings
+ Here is the call graph for this function:

◆ addIntroductionToSettingsFromImport()

ilObjTest::addIntroductionToSettingsFromImport ( SettingsIntroduction  $settings,
array  $material,
string  $importdir,
array  $mappings 
)
private

Definition at line 3241 of file class.ilObjTest.php.

References ilObject\getId(), ILIAS\Test\Settings\TestSettings\getTestId(), replaceFilesInPageImports(), replaceMobsInPageImports(), retrieveMobsFromLegacyImports(), and ILIAS\Test\Settings\MainSettings\SettingsIntroduction\withIntroductionPageId().

Referenced by fromXML().

3247  $text = $material['text'];
3248  $mobs = $material['mobs'];
3249  if (str_starts_with($text, '<PageObject>')) {
3250  $text = $this->replaceMobsInPageImports(
3251  $text,
3252  $mappings['components/ILIAS/MediaObjects']['mob'] ?? []
3253  );
3254  $text = $this->replaceFilesInPageImports(
3255  $text,
3256  $mappings['components/ILIAS/File']['file'] ?? []
3257  );
3258  $page_object = new ilTestPage();
3259  $page_object->setParentId($this->getId());
3260  $page_object->setXMLContent($text);
3261  $new_page_id = $page_object->createPageWithNextId();
3262  return $settings->withIntroductionPageId($new_page_id);
3263  }
3264 
3265  $text = $this->retrieveMobsFromLegacyImports($text, $mobs, $importdir);
3266 
3267  return new SettingsIntroduction(
3268  $settings->getTestId(),
3269  $text !== '',
3270  $text
3271  );
3272  }
replaceFilesInPageImports(string $text, array $mappings)
replaceMobsInPageImports(string $text, array $mappings)
retrieveMobsFromLegacyImports(string $text, array $mobs, string $importdir)
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQTIMaterial()

ilObjTest::addQTIMaterial ( ilXmlWriter $xml_writer,
?int  $page_id,
string  $material = '' 
)

Definition at line 5480 of file class.ilObjTest.php.

References ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilPCFileList\collectFileItems(), ilObject\getId(), IL_INST_ID, ILIAS\Repository\int(), isHTML(), null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by toXML().

5480  : void
5481  {
5482  $xml_writer->xmlStartTag('material');
5483  $attrs = [
5484  'texttype' => 'text/plain'
5485  ];
5486  $file_ids = [];
5487  $mobs = [];
5488  if ($page_id !== null) {
5489  $attrs['texttype'] = 'text/xml';
5490  $mobs = ilObjMediaObject::_getMobsOfObject('tst:pg', $page_id);
5491  $page_object = new ilTestPage($page_id);
5492  $page_object->buildDom();
5493  $page_object->insertInstIntoIDs((string) IL_INST_ID);
5494  $material = base64_encode($page_object->getXMLFromDom());
5495  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
5496  foreach ($file_ids as $file_id) {
5497  $this->file_ids[] = (int) $file_id;
5498  };
5499  $mob_string = 'il_' . IL_INST_ID . '_mob_';
5500  } elseif ($this->isHTML($material)) {
5501  $attrs['texttype'] = 'text/xhtml';
5502  $mobs = ilObjMediaObject::_getMobsOfObject('tst:html', $this->getId());
5503  $mob_string = 'mm_';
5504  }
5505 
5506  $xml_writer->xmlElement('mattext', $attrs, $material);
5507  foreach ($mobs as $mob) {
5508  $mob_id_string = (string) $mob;
5509  $moblabel = 'il_' . IL_INST_ID . '_mob_' . $mob_id_string;
5510  if (strpos($material, $mob_string . $mob_id_string) !== false) {
5511  if (ilObjMediaObject::_exists($mob)) {
5512  $mob_obj = new ilObjMediaObject($mob);
5513  $imgattrs = [
5514  'label' => $moblabel,
5515  'uri' => 'objects/' . 'il_' . IL_INST_ID . '_mob_' . $mob_id_string . '/' . $mob_obj->getTitle()
5516  ];
5517  }
5518  $xml_writer->xmlElement('matimage', $imgattrs, null);
5519  }
5520  }
5521  $xml_writer->xmlEndTag('material');
5522  }
isHTML($a_text)
Checks if a given string contains HTML or not.
const IL_INST_ID
Definition: constants.php:40
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
static _exists(int $id, bool $reference=false, ?string $type=null)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToNewsOnOnline()

ilObjTest::addToNewsOnOnline ( bool  $old_online_status,
bool  $new_online_status 
)

Definition at line 7519 of file class.ilObjTest.php.

References ilNewsItem\deleteNewsOfContext(), ilNewsItem\getFirstNewsIdForContext(), ilObject\getId(), NEWS_NOTICE, NEWS_USERS, and ILIAS\Repository\user().

Referenced by fromXML().

7522  : void {
7523  if (!$old_online_status && $new_online_status) {
7524  $newsItem = new ilNewsItem();
7525  $newsItem->setContext($this->getId(), 'tst');
7526  $newsItem->setPriority(NEWS_NOTICE);
7527  $newsItem->setTitle('new_test_online');
7528  $newsItem->setContentIsLangVar(true);
7529  $newsItem->setContent('');
7530  $newsItem->setUserId($this->user->getId());
7531  $newsItem->setVisibility(NEWS_USERS);
7532  $newsItem->create();
7533  return;
7534  }
7535 
7536  if ($old_online_status && !$new_online_status) {
7537  ilNewsItem::deleteNewsOfContext($this->getId(), 'tst');
7538  return;
7539  }
7540 
7541  $newsId = ilNewsItem::getFirstNewsIdForContext($this->getId(), 'tst');
7542  if (!$new_online_status && $newsId > 0) {
7543  $newsItem = new ilNewsItem($newsId);
7544  $newsItem->setTitle('new_test_online');
7545  $newsItem->setContentIsLangVar(true);
7546  $newsItem->setContent('');
7547  $newsItem->update();
7548  }
7549  }
static deleteNewsOfContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Delete all news of a context.
const NEWS_NOTICE
A news item can be created by different sources.
static getFirstNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
const NEWS_USERS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustTestSequence()

ilObjTest::adjustTestSequence ( )

Definition at line 7205 of file class.ilObjTest.php.

References getShuffleQuestions(), and getTestId().

7206  {
7207  $query = "
7208  SELECT COUNT(test_question_id) cnt
7209  FROM tst_test_question
7210  WHERE test_fi = %s
7211  ORDER BY sequence
7212  ";
7213 
7214  $questRes = $this->db->queryF($query, ['integer'], [$this->getTestId()]);
7215 
7216  $row = $this->db->fetchAssoc($questRes);
7217  $questCount = $row['cnt'];
7218 
7219  if ($this->getShuffleQuestions()) {
7220  $query = "
7221  SELECT tseq.*
7222  FROM tst_active tac
7223  INNER JOIN tst_sequence tseq
7224  ON tseq.active_fi = tac.active_id
7225  WHERE tac.test_fi = %s
7226  ";
7227 
7228  $partRes = $this->db->queryF(
7229  $query,
7230  ['integer'],
7231  [$this->getTestId()]
7232  );
7233 
7234  while ($row = $this->db->fetchAssoc($partRes)) {
7235  $sequence = @unserialize($row['sequence']);
7236 
7237  if (!$sequence) {
7238  $sequence = [];
7239  }
7240 
7241  $sequence = array_filter($sequence, function ($value) use ($questCount) {
7242  return $value <= $questCount;
7243  });
7244 
7245  $num_seq = count($sequence);
7246  if ($questCount > $num_seq) {
7247  $diff = $questCount - $num_seq;
7248  for ($i = 1; $i <= $diff; $i++) {
7249  $sequence[$num_seq + $i - 1] = $num_seq + $i;
7250  }
7251  }
7252 
7253  $new_sequence = serialize($sequence);
7254 
7255  $this->db->update('tst_sequence', [
7256  'sequence' => ['clob', $new_sequence]
7257  ], [
7258  'active_fi' => ['integer', $row['active_fi']],
7259  'pass' => ['integer', $row['pass']]
7260  ]);
7261  }
7262  } else {
7263  $new_sequence = serialize($questCount > 0 ? range(1, $questCount) : []);
7264 
7265  $query = "
7266  SELECT tseq.*
7267  FROM tst_active tac
7268  INNER JOIN tst_sequence tseq
7269  ON tseq.active_fi = tac.active_id
7270  WHERE tac.test_fi = %s
7271  ";
7272 
7273  $part_rest = $this->db->queryF(
7274  $query,
7275  ['integer'],
7276  [$this->getTestId()]
7277  );
7278 
7279  while ($row = $this->db->fetchAssoc($part_rest)) {
7280  $this->db->update('tst_sequence', [
7281  'sequence' => ['clob', $new_sequence]
7282  ], [
7283  'active_fi' => ['integer', $row['active_fi']],
7284  'pass' => ['integer', $row['pass']]
7285  ]);
7286  }
7287  }
7288  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ applyDefaults()

ilObjTest::applyDefaults ( array  $test_defaults)

Definition at line 5787 of file class.ilObjTest.php.

References convertTimeToDateTimeImmutableIfNecessary(), ILIAS\Test\Settings\MainSettings\MainSettings\getAccessSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getAdditionalSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getFinishingSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getGamificationSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getGeneralSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getIntroductionSettings(), getMainSettings(), getMainSettingsRepository(), getMarkSchema(), ILIAS\Test\Settings\MainSettings\MainSettings\getParticipantFunctionalitySettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getQuestionBehaviourSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultDetailsSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultSummarySettings(), getScoreSettings(), getScoreSettingsRepository(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getScoringSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getTestBehaviourSettings(), ILIAS\Repository\int(), null, saveToDb(), storeActivationSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\withGeneralSettings(), and ILIAS\Test\Settings\ScoreReporting\ScoreSettings\withScoringSettings().

5787  : string
5788  {
5789  $testsettings = unserialize($test_defaults['defaults'], ['allowed_classes' => [DateTimeImmutable::class]]);
5790  $activation_starting_time = is_numeric($testsettings['activation_starting_time'] ?? false)
5791  ? (int) $testsettings['activation_starting_time']
5792  : null;
5793  $activation_ending_time = is_numeric($testsettings['activation_ending_time'] ?? false)
5794  ? (int) $testsettings['activation_ending_time']
5795  : null;
5796  $unserialized_marks = json_decode($test_defaults['marks'], true);
5797 
5798  $info = '';
5799  if (is_array($unserialized_marks)
5800  && is_array($unserialized_marks[0])) {
5801  $this->mark_schema = $this->getMarkSchema()->withMarkSteps(
5802  array_map(
5803  fn(array $v): Mark => new Mark(
5804  $v['short_name'],
5805  $v['official_name'],
5806  $v['minimum_level'],
5807  $v['passed']
5808  ),
5809  $unserialized_marks
5810  )
5811  );
5812  } else {
5813  $info = 'old_mark_default_not_applied';
5814  }
5815 
5816 
5817  $this->storeActivationSettings(
5818  (bool) ($testsettings['is_activation_limited'] ?? false),
5821  (bool) ($testsettings['activation_visibility'] ?? false),
5822  );
5823 
5824  $main_settings = $this->getMainSettings();
5828  ->withQuestionSetType($testsettings['questionSetType'])
5829  ->withAnonymity((bool) $testsettings['Anonymity'])
5830  )
5831  ->withIntroductionSettings(
5833  ->withIntroductionEnabled((bool) $testsettings['IntroEnabled'])
5834  ->withExamConditionsCheckboxEnabled((bool) ($testsettings['ExamConditionsCheckboxEnabled'] ?? false))
5835  )
5836  ->withAccessSettings(
5838  ->withStartTimeEnabled((bool) $testsettings['StartingTimeEnabled'])
5839  ->withStartTime($this->convertTimeToDateTimeImmutableIfNecessary($testsettings['StartingTime']))
5840  ->withEndTimeEnabled((bool) $testsettings['EndingTimeEnabled'])
5841  ->withEndTime($this->convertTimeToDateTimeImmutableIfNecessary($testsettings['EndingTime']))
5842  ->withPasswordEnabled((bool) $testsettings['password_enabled'])
5843  ->withPassword($testsettings['password'])
5844  ->withFixedParticipants((bool) $testsettings['fixed_participants'])
5845  )
5846  ->withTestBehaviourSettings(
5848  ->withNumberOfTries($testsettings['NrOfTries'])
5849  ->withBlockAfterPassedEnabled((bool) $testsettings['BlockAfterPassed'])
5850  ->withPassWaiting($testsettings['pass_waiting'])
5851  ->withKioskMode($testsettings['Kiosk'])
5852  ->withProcessingTimeEnabled((bool) $testsettings['EnableProcessingTime'])
5853  ->withProcessingTime($testsettings['ProcessingTime'])
5854  ->withResetProcessingTime((bool) $testsettings['ResetProcessingTime'])
5855  ->withExamIdInTestAttemptEnabled((bool) ($testsettings['examid_in_test_pass'] ?? 0))
5856  )
5857  ->withQuestionBehaviourSettings(
5859  ->withQuestionTitleOutputMode($testsettings['TitleOutput'])
5860  ->withAutosaveEnabled((bool) $testsettings['autosave'])
5861  ->withAutosaveInterval($testsettings['autosave_ival'])
5862  ->withShuffleQuestions((bool) $testsettings['Shuffle'])
5863  ->withQuestionHintsEnabled((bool) $testsettings['offer_question_hints'])
5864  ->withInstantFeedbackPointsEnabled((bool) $testsettings['AnswerFeedbackPoints'])
5865  ->withInstantFeedbackGenericEnabled((bool) $testsettings['AnswerFeedback'])
5866  ->withInstantFeedbackSpecificEnabled((bool) $testsettings['SpecificAnswerFeedback'])
5867  ->withInstantFeedbackSolutionEnabled((bool) $testsettings['InstantFeedbackSolution'])
5868  ->withForceInstantFeedbackOnNextQuestion((bool) $testsettings['force_inst_fb'])
5869  ->withLockAnswerOnInstantFeedbackEnabled((bool) $testsettings['inst_fb_answer_fixation'])
5870  ->withLockAnswerOnNextQuestionEnabled((bool) $testsettings['follow_qst_answer_fixation'])
5871  )
5872  ->withParticipantFunctionalitySettings(
5874  ->withUsePreviousAnswerAllowed((bool) $testsettings['use_previous_answers'])
5875  ->withSuspendTestAllowed((bool) $testsettings['ShowCancel'])
5876  ->withPostponedQuestionsMoveToEnd((bool) $testsettings['SequenceSettings'])
5877  ->withUsrPassOverviewMode((int) $testsettings['ListOfQuestionsSettings'])
5878  ->withQuestionMarkingEnabled((bool) $testsettings['ShowMarker'])
5879  )
5880  ->withFinishingSettings(
5882  ->withShowAnswerOverview((bool) $testsettings['enable_examview'])
5883  ->withConcludingRemarksEnabled((bool) $testsettings['ShowFinalStatement'])
5884  ->withRedirectionMode((int) $testsettings['redirection_mode'])
5885  ->withRedirectionUrl($testsettings['redirection_url'])
5886  ->withMailNotificationContentType((int) $testsettings['mailnotification'])
5887  ->withAlwaysSendMailNotification((bool) $testsettings['mailnottype'])
5888  )
5889  ->withAdditionalSettings(
5891  ->withSkillsServiceEnabled((bool) $testsettings['skill_service'])
5892  ->withHideInfoTab((bool) ($testsettings['HideInfoTab'] ?? false))
5893  );
5894 
5895  $this->getMainSettingsRepository()->store($main_settings);
5896 
5897  $score_reporting = ScoreReportingTypes::SCORE_REPORTING_DISABLED;
5898  if ($testsettings['ScoreReporting'] !== null) {
5899  $score_reporting = ScoreReportingTypes::tryFrom($testsettings['ScoreReporting'])
5900  ?? ScoreReportingTypes::SCORE_REPORTING_DISABLED;
5901  }
5902 
5903  $reporting_date = $testsettings['ReportingDate'];
5904  if (is_string($reporting_date)) {
5905  $reporting_date = new DateTimeImmutable($testsettings['ReportingDate'], new DateTimeZone('UTC'));
5906  }
5907 
5908  $score_settings = $this->getScoreSettings();
5912  ->withPassScoring($testsettings['PassScoring'])
5913  ->withScoreCutting($testsettings['ScoreCutting'])
5914  ->withCountSystem($testsettings['CountSystem'])
5915  )
5916  ->withResultSummarySettings(
5918  ->withPassDeletionAllowed((bool) $testsettings['pass_deletion_allowed'])
5919  ->withShowGradingStatusEnabled((bool) $testsettings['show_grading_status'])
5920  ->withShowGradingMarkEnabled((bool) $testsettings['show_grading_mark'])
5921  ->withScoreReporting($score_reporting)
5922  ->withReportingDate($reporting_date)
5923  )
5924  ->withResultDetailsSettings(
5926  ->withResultsPresentation((int) $testsettings['ResultsPresentation'])
5927  ->withShowSolutionListComparison((bool) ($testsettings['show_solution_list_comparison'] ?? 0))
5928  ->withShowExamIdInTestResults((bool) $testsettings['examid_in_test_res'])
5929  )
5930  ->withGamificationSettings(
5932  ->withHighscoreEnabled((bool) $testsettings['highscore_enabled'])
5933  ->withHighscoreAnon((bool) $testsettings['highscore_anon'])
5934  ->withHighscoreAchievedTS($testsettings['highscore_achieved_ts'])
5935  ->withHighscoreScore((bool) $testsettings['highscore_score'])
5936  ->withHighscorePercentage($testsettings['highscore_percentage'])
5937  ->withHighscoreHints((bool) $testsettings['highscore_hints'])
5938  ->withHighscoreWTime((bool) $testsettings['highscore_wtime'])
5939  ->withHighscoreOwnTable((bool) $testsettings['highscore_own_table'])
5940  ->withHighscoreTopTable((bool) $testsettings['highscore_top_table'])
5941  ->withHighscoreTopNum($testsettings['highscore_top_num'])
5942  )
5943  ;
5945  $this->saveToDb();
5946 
5947  return $info;
5948  }
int $activation_starting_time
A class defining marks for assessment test objects.
Definition: Mark.php:35
saveToDb(bool $properties_only=false)
withGeneralSettings(SettingsGeneral $settings)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
MainSettings $main_settings
convertTimeToDateTimeImmutableIfNecessary(DateTimeImmutable|int|null $date_time)
storeActivationSettings(?bool $is_activation_limited=false, ?int $activation_starting_time=null, ?int $activation_ending_time=null, bool $activation_visibility=false,)
int $activation_ending_time
ScoreSettings $score_settings
getScoreSettingsRepository()
+ Here is the call graph for this function:

◆ buildDateTimeImmutableFromPeriod()

ilObjTest::buildDateTimeImmutableFromPeriod ( ?string  $period)
protected

Definition at line 3807 of file class.ilObjTest.php.

References null.

Referenced by fromXML().

3808  {
3809  if ($period === null) {
3810  return null;
3811  }
3812  if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $period, $matches)) {
3813  return new DateTimeImmutable(
3814  sprintf(
3815  "%02d-%02d-%02d %02d:%02d:%02d",
3816  $matches[1],
3817  $matches[2],
3818  $matches[3],
3819  $matches[4],
3820  $matches[5],
3821  $matches[6]
3822  ),
3823  new \DateTimeZone('UTC')
3824  );
3825  }
3826  return null;
3827  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ buildExamId()

static ilObjTest::buildExamId (   $active_id,
  $pass,
  $test_obj_id = null 
)
static

Definition at line 6997 of file class.ilObjTest.php.

References $DIC, $ilSetting, and null.

Referenced by ilTestPlayerAbstractGUI\getTestPlayerTitle(), and updateTestPassResults().

6997  : string
6998  {
6999  global $DIC;
7000  $ilSetting = $DIC['ilSetting'];
7001 
7002  $inst_id = $ilSetting->get('inst_id', null);
7003 
7004  if ($test_obj_id === null) {
7005  $obj_id = self::_getObjectIDFromActiveID($active_id);
7006  } else {
7007  $obj_id = $test_obj_id;
7008  }
7009 
7010  $examId = 'I' . $inst_id . '_T' . $obj_id . '_A' . $active_id . '_P' . $pass;
7011 
7012  return $examId;
7013  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
global $ilSetting
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ buildIso8601PeriodForExportCompatibility()

ilObjTest::buildIso8601PeriodForExportCompatibility ( DateTimeImmutable  $date_time)
protected

Definition at line 3802 of file class.ilObjTest.php.

Referenced by toXML().

3802  : string
3803  {
3804  return $date_time->setTimezone(new DateTimeZone('UTC'))->format('\PY\Yn\Mj\D\TG\Hi\Ms\S');
3805  }
+ Here is the caller graph for this function:

◆ buildName()

ilObjTest::buildName ( ?int  $user_id,
?string  $firstname,
?string  $lastname 
)

Builds a user name for the output depending on test type and existence of the user.

Parameters
int$user_idThe database ID of the user
string$firstnameThe first name of the user
string$lastnameThe last name of the user
string$titleThe title of the user
Returns
string The output name of the user public

Definition at line 2562 of file class.ilObjTest.php.

References ANONYMOUS_USER_ID, getAnonymity(), ILIAS\Repository\lng(), and null.

2566  : string {
2567  if ($user_id === null
2568  || $firstname . $lastname === '') {
2569  return $this->lng->txt('deleted_user');
2570  }
2571 
2572  if ($this->getAnonymity()) {
2573  return $this->lng->txt('anonymous');
2574  }
2575 
2576  if ($user_id == ANONYMOUS_USER_ID) {
2577  return $lastname;
2578  }
2579 
2580  return trim($lastname . ', ' . $firstname);
2581  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ buildStatisticsAccessFilteredParticipantList()

ilObjTest::buildStatisticsAccessFilteredParticipantList ( )

Definition at line 2467 of file class.ilObjTest.php.

References getTestParticipants(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

2468  {
2469  $list = new ilTestParticipantList($this, $this->user, $this->lng, $this->db);
2470  $list->initializeFromDbRows($this->getTestParticipants());
2471 
2472  return $list->getAccessFilteredList(
2473  $this->participant_access_filter->getAccessStatisticsUserFilter($this->getRefId())
2474  );
2475  }
+ Here is the call graph for this function:

◆ canShowSolutionPrintview()

ilObjTest::canShowSolutionPrintview (   $user_id = null)
Deprecated:

Definition at line 5315 of file class.ilObjTest.php.

References getShowSolutionPrintview().

5315  : bool
5316  {
5317  return $this->getShowSolutionPrintview();
5318  }
getShowSolutionPrintview()
Returns if the solution printview should be presented to the user or not.
+ Here is the call graph for this function:

◆ canShowTestResults()

ilObjTest::canShowTestResults ( ilTestSession  $test_session)

Definition at line 5058 of file class.ilObjTest.php.

References ilTestSession\getActiveId(), and ilTestSession\getLastFinishedPass().

Referenced by ilTestSession\reportableResultsAvailable().

5058  : bool
5059  {
5060  $passSelector = new ilTestPassesSelector($this->db, $this);
5061 
5062  $passSelector->setActiveId($test_session->getActiveId());
5063  $passSelector->setLastFinishedPass($test_session->getLastFinishedPass());
5064 
5065  return $passSelector->hasReportablePasses();
5066  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkQuestionParent()

ilObjTest::checkQuestionParent ( int  $question_id)

Definition at line 5196 of file class.ilObjTest.php.

5196  : bool
5197  {
5198  $row = $this->db->fetchAssoc($this->db->queryF(
5199  "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
5200  ['integer', 'integer'],
5201  [$question_id, $this->getId()]
5202  ));
5203 
5204  return (bool) $row['cnt'];
5205  }

◆ cloneConcludingRemarks()

ilObjTest::cloneConcludingRemarks ( )
private

Definition at line 710 of file class.ilObjTest.php.

References clonePage(), getMainSettings(), and null.

Referenced by cloneObject().

710  : ?int
711  {
712  $page_id = $this->getMainSettings()->getFinishingSettings()->getConcludingRemarksPageId();
713  if ($page_id === null) {
714  return null;
715  }
716  return $this->clonePage($page_id);
717  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
clonePage(int $source_page_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneIntroduction()

ilObjTest::cloneIntroduction ( )
private

Definition at line 692 of file class.ilObjTest.php.

References clonePage(), getMainSettings(), and null.

Referenced by cloneObject().

692  : ?int
693  {
694  $page_id = $this->getMainSettings()->getIntroductionSettings()->getIntroductionPageId();
695  if ($page_id === null) {
696  return null;
697  }
698  return $this->clonePage($page_id);
699  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
clonePage(int $source_page_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneObject()

ilObjTest::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Clone object.

public

Parameters
intref id of parent container
intcopy id
Returns
object new test object

Definition at line 4128 of file class.ilObjTest.php.

References cloneConcludingRemarks(), cloneIntroduction(), ilObject\cloneMetaData(), ilObject\getId(), getMainSettings(), getMainSettingsRepository(), getMarkSchema(), getScoreSettings(), getScoreSettingsRepository(), getTemplate(), getTestId(), loadFromDb(), and ILIAS\Repository\user().

4128  : ?ilObject
4129  {
4130  $this->loadFromDb();
4131 
4132  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
4133  $new_obj->setTmpCopyWizardCopyId($copy_id);
4134  $this->cloneMetaData($new_obj);
4135 
4136  $new_obj->saveToDb();
4137  $new_obj->addToNewsOnOnline(false, $new_obj->getObjectProperties()->getPropertyIsOnline()->getIsOnline());
4138  $this->getMainSettingsRepository()->store(
4139  $this->getMainSettings()->withTestId($new_obj->getTestId())
4140  ->withIntroductionSettings(
4141  $this->getMainSettings()->getIntroductionSettings()->withIntroductionPageId(
4142  $this->cloneIntroduction()
4143  )->withTestId($new_obj->getTestId())
4144  )->withFinishingSettings(
4145  $this->getMainSettings()->getFinishingSettings()->withConcludingRemarksPageId(
4146  $this->cloneConcludingRemarks()
4147  )->withTestId($new_obj->getTestId())
4148  )
4149  );
4150  $this->getScoreSettingsRepository()->store(
4151  $this->getScoreSettings()->withTestId($new_obj->getTestId())
4152  );
4153  $this->marks_repository->storeMarkSchema(
4154  $this->getMarkSchema()->withTestId($new_obj->getTestId())
4155  );
4156 
4157  $new_obj->setTemplate($this->getTemplate());
4158 
4159  // clone certificate
4160  $pathFactory = new ilCertificatePathFactory();
4161  $templateRepository = new ilCertificateTemplateDatabaseRepository($this->db);
4162 
4163  $cloneAction = new ilCertificateCloneAction(
4164  $this->db,
4165  $pathFactory,
4166  $templateRepository,
4168  );
4169 
4170  $cloneAction->cloneCertificate($this, $new_obj);
4171 
4172  $this->question_set_config_factory->getQuestionSetConfig()->cloneQuestionSetRelatedData($new_obj);
4173  $new_obj->saveQuestionsToDb();
4174 
4175  $skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
4176  $skillLevelThresholdList->setTestId($this->getTestId());
4177  $skillLevelThresholdList->loadFromDb();
4178  $skillLevelThresholdList->cloneListForTest($new_obj->getTestId());
4179 
4180  $obj_settings = new ilLPObjSettings($this->getId());
4181  $obj_settings->cloneSettings($new_obj->getId());
4182 
4183  if ($new_obj->getTestLogger()->isLoggingEnabled()) {
4184  $new_obj->getTestLogger()->logTestAdministrationInteraction(
4185  $new_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
4186  $new_obj->getRefId(),
4187  $this->user->getId(),
4188  TestAdministrationInteractionTypes::NEW_TEST_CREATED,
4189  []
4190  )
4191  );
4192  }
4193 
4194  return $new_obj;
4195  }
getTestId()
Gets the database id of the additional test data.
cloneMetaData(ilObject $target_obj)
Copy meta data.
getScoreSettingsRepository()
+ Here is the call graph for this function:

◆ clonePage()

ilObjTest::clonePage ( int  $source_page_id)
private

Definition at line 719 of file class.ilObjTest.php.

References ilObject\getId().

Referenced by cloneConcludingRemarks(), and cloneIntroduction().

719  : int
720  {
721  $page_object = new ilTestPage();
722  $page_object->setParentId($this->getId());
723  $new_page_id = $page_object->createPageWithNextId();
724  (new ilTestPage($source_page_id))->copy($new_page_id);
725  return $new_page_id;
726  }
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertTimeToDateTimeImmutableIfNecessary()

ilObjTest::convertTimeToDateTimeImmutableIfNecessary ( DateTimeImmutable|int|null  $date_time)
private

Definition at line 5950 of file class.ilObjTest.php.

References null.

Referenced by applyDefaults().

5952  : ?DateTimeImmutable {
5953  if ($date_time === null || $date_time instanceof DateTimeImmutable) {
5954  return $date_time;
5955  }
5956 
5957  return DateTimeImmutable::createFromFormat('U', (string) $date_time);
5958  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ copyQuestions()

ilObjTest::copyQuestions ( array  $question_ids)
Parameters
array<int>$question_ids

Definition at line 561 of file class.ilObjTest.php.

References $id, ilObject\$title, ilObject\getId(), getQuestionTitles(), and insertQuestion().

561  : void
562  {
563  $copy_count = 0;
564  $question_titles = $this->getQuestionTitles();
565 
566  foreach ($question_ids as $id) {
567  $question = assQuestion::instantiateQuestionGUI($id);
568  if ($question) {
569  $title = $question->getObject()->getTitle();
570  $i = 2;
571  while (in_array($title . ' (' . $i . ')', $question_titles)) {
572  $i++;
573  }
574 
575  $title .= ' (' . $i . ')';
576 
577  $question_titles[] = $title;
578 
579  $new_id = $question->getObject()->duplicate(false, $title);
580 
581  $clone = assQuestion::instantiateQuestionGUI($new_id);
582  $question = $clone->getObject();
583  $question->setObjId($this->getId());
584  $clone->setObject($question);
585  $clone->getObject()->saveToDb();
586 
587  $this->insertQuestion($new_id, true);
588 
589  $copy_count++;
590  }
591  }
592  }
string $title
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
insertQuestion(int $question_id, bool $link_only=false)
+ Here is the call graph for this function:

◆ create()

ilObjTest::create ( )

Definition at line 239 of file class.ilObjTest.php.

References $id, and ilObject\createMetaData().

239  : int
240  {
241  $id = parent::create();
242  $this->createMetaData();
243  return $id;
244  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjTest::createExportDirectory ( )

creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directory that is set in ILIAS setup/ini)

Definition at line 342 of file class.ilObjTest.php.

References ilFileUtils\getDataDir(), ilObject\getId(), and ilFileUtils\makeDir().

342  : void
343  {
344  $tst_data_dir = ilFileUtils::getDataDir() . "/tst_data";
345  ilFileUtils::makeDir($tst_data_dir);
346  if (!is_writable($tst_data_dir)) {
347  $this->ilias->raiseError("Test Data Directory (" . $tst_data_dir
348  . ") not writeable.", $this->ilias->error_obj->MESSAGE);
349  }
350 
351  // create learning module directory (data_dir/lm_data/lm_<id>)
352  $tst_dir = $tst_data_dir . "/tst_" . $this->getId();
353  ilFileUtils::makeDir($tst_dir);
354  if (!@is_dir($tst_dir)) {
355  $this->ilias->raiseError("Creation of Test Directory failed.", $this->ilias->error_obj->MESSAGE);
356  }
357  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
358  $export_dir = $tst_dir . "/export";
359  ilFileUtils::makeDir($export_dir);
360  if (!@is_dir($export_dir)) {
361  $this->ilias->raiseError("Creation of Export Directory failed.", $this->ilias->error_obj->MESSAGE);
362  }
363  }
Class ilObjForumAdministration.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ createQuestionGUI()

ilObjTest::createQuestionGUI (   $question_type,
  $question_id = -1 
)

Creates a question GUI instance of a given question type.

Parameters
integer$question_typeThe question type of the question
integer$question_idThe question id of the question, if available
Returns
assQuestionGUI $questionGUI The question GUI instance public

Definition at line 2689 of file class.ilObjTest.php.

References getQuestionType(), and null.

Referenced by ILIAS\Test\Results\Data\Factory\buildAttemptResults().

2689  : ?assQuestionGUI
2690  {
2691  if ((!$question_type) and ($question_id > 0)) {
2692  $question_type = $this->getQuestionType($question_id);
2693  }
2694 
2695  if (!strlen($question_type)) {
2696  return null;
2697  }
2698 
2699  if ($question_id > 0) {
2700  $question_gui = assQuestion::instantiateQuestionGUI($question_id);
2701  } else {
2702  $question_type_gui = $question_type . 'GUI';
2703  $question_gui = new $question_type_gui();
2704  }
2705 
2706  return $question_gui;
2707  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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:

◆ createTestSequence()

& ilObjTest::createTestSequence (   $active_id,
  $pass,
  $shuffle 
)

Definition at line 6234 of file class.ilObjTest.php.

References isRandomTest().

6235  {
6236  $this->test_sequence = new ilTestSequence($active_id, $pass, $this->isRandomTest(), $this->questionrepository);
6237  }
Test sequence handler.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:

◆ delete()

ilObjTest::delete ( )

Definition at line 266 of file class.ilObjTest.php.

References ilObject\$title, ilObject\deleteMetaData(), deleteTest(), ilObject\getId(), ilObject\getRefId(), ILIAS\Repository\logger(), ILIAS\Test\Logging\TEST_DELETED, and ILIAS\Repository\user().

266  : bool
267  {
268  // always call parent delete function first!!
269  if (!parent::delete()) {
270  return false;
271  }
272 
273  // delet meta data
274  $this->deleteMetaData();
275 
276  //put here your module specific stuff
277  $this->deleteTest();
278 
279  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getId());
280  $qsaImportFails->deleteRegisteredImportFails();
281  $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->getId());
282  $sltImportFails->deleteRegisteredImportFails();
283 
284  if ($this->logger->isLoggingEnabled()) {
285  $this->logger->logTestAdministrationInteraction(
286  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
287  $this->getRefId(),
288  $this->user->getId(),
290  [
291  AdditionalInformationGenerator::KEY_TEST_TITLE => $test_title = $this->title
292  ]
293  )
294  );
295  }
296 
297  return true;
298  }
string $title
+ Here is the call graph for this function:

◆ deleteDefaults()

ilObjTest::deleteDefaults (   $test_default_id)

Definition at line 5659 of file class.ilObjTest.php.

5660  {
5661  $this->db->manipulateF(
5662  "DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
5663  ['integer'],
5664  [$test_default_id]
5665  );
5666  }

◆ deleteTest()

ilObjTest::deleteTest ( )

Definition at line 300 of file class.ilObjTest.php.

References ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilFileUtils\delDir(), ilFileUtils\getDataDir(), ilObject\getId(), getTestId(), ILIAS\Repository\lng(), and removeTestResults().

Referenced by delete().

300  : void
301  {
302  $participantData = new ilTestParticipantData($this->db, $this->lng);
303  $participantData->load($this->getTestId());
304  $this->removeTestResults($participantData);
305 
306  $this->db->manipulateF(
307  "DELETE FROM tst_mark WHERE test_fi = %s",
308  ['integer'],
309  [$this->getTestId()]
310  );
311 
312  $this->db->manipulateF(
313  "DELETE FROM tst_tests WHERE test_id = %s",
314  ['integer'],
315  [$this->getTestId()]
316  );
317 
318  $tst_data_dir = ilFileUtils::getDataDir() . "/tst_data";
319  $directory = $tst_data_dir . "/tst_" . $this->getId();
320  if (is_dir($directory)) {
321  ilFileUtils::delDir($directory);
322  }
323  $mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->getId());
324  // remaining usages are not in text anymore -> delete them
325  // and media objects (note: delete method of ilObjMediaObject
326  // checks whether object is used in another context; if yes,
327  // the object is not deleted!)
328  foreach ($mobs as $mob) {
329  ilObjMediaObject::_removeUsage($mob, "tst:html", $this->getId());
330  if (ilObjMediaObject::_exists($mob)) {
331  $mob_obj = new ilObjMediaObject($mob);
332  $mob_obj->delete();
333  }
334  }
335  }
removeTestResults(ilTestParticipantData $participant_data)
getTestId()
Gets the database id of the additional test data.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDataDir()
get data directory (outside webspace)
static _exists(int $id, bool $reference=false, ?string $type=null)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _removeUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Remove usage of mob in another container.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverPDFfromFO()

ilObjTest::deliverPDFfromFO (   $fo,
  $title = null 
)

Delivers a PDF file from a XSL-FO string.

Parameters
string$foThe XSL-FO string public

PhpUndefinedFieldInspection

Definition at line 6045 of file class.ilObjTest.php.

References Vendor\Package\$e, $filename, ilObject\$title, ilUtil\deliverData(), ilRpcClientFactory\factory(), ilFileUtils\getASCIIFilename(), ilObject\getTitle(), ilFileUtils\ilTempnam(), and ILIAS\Repository\logger().

Referenced by deliverPDFfromHTML().

6045  : bool
6046  {
6047  $fo_file = ilFileUtils::ilTempnam() . ".fo";
6048  $fp = fopen($fo_file, "w");
6049  fwrite($fp, $fo);
6050  fclose($fp);
6051 
6052  try {
6053  $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($fo);
6054  $filename = (strlen($title)) ? $title : $this->getTitle();
6057  $pdf_base64->scalar,
6059  "application/pdf"
6060  );
6061  return true;
6062  } catch (Exception $e) {
6063  $this->logger->info(__METHOD__ . ': ' . $e->getMessage());
6064  return false;
6065  }
6066  }
string $title
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
static getASCIIFilename(string $a_filename)
$filename
Definition: buildRTE.php:78
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverPDFfromHTML()

ilObjTest::deliverPDFfromHTML (   $content,
  $title = null 
)

Delivers a PDF file from XHTML.

Parameters
string$htmlThe XHTML string public

Definition at line 6009 of file class.ilObjTest.php.

References ilObject\$title, deliverPDFfromFO(), ilUtil\getStyleSheetLocation(), ilObject\getTitle(), ilLegacyFormElementsUtil\prepareFormOutput(), and processPrintoutput2FO().

6010  {
6011  $content = preg_replace("/href=\".*?\"/", "", $content);
6012  $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", true, true, "components/ILIAS/Test");
6013  $printbody->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($this->getTitle()));
6014  $printbody->setVariable("ADM_CONTENT", $content);
6015  $printbody->setCurrentBlock("css_file");
6016  $printbody->setVariable("CSS_FILE", ilUtil::getStyleSheetLocation("filesystem", "delos.css"));
6017  $printbody->parseCurrentBlock();
6018  $printoutput = $printbody->get();
6019  $html = str_replace("href=\"./", "href=\"" . ILIAS_HTTP_PATH . "/", $printoutput);
6020  $html = preg_replace("/<div id=\"dontprint\">.*?<\\/div>/ims", "", $html);
6021  if (extension_loaded("tidy")) {
6022  $config = [
6023  "indent" => false,
6024  "output-xml" => true,
6025  "numeric-entities" => true
6026  ];
6027  $tidy = new tidy();
6028  $tidy->parseString($html, $config, 'utf8');
6029  $tidy->cleanRepair();
6030  $html = tidy_get_output($tidy);
6031  $html = preg_replace("/^.*?(<html)/", "\\1", $html);
6032  } else {
6033  $html = str_replace("&nbsp;", "&#160;", $html);
6034  $html = str_replace("&otimes;", "X", $html);
6035  }
6036  $html = preg_replace("/src=\".\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $html);
6037  $this->deliverPDFfromFO($this->processPrintoutput2FO($html), $title);
6038  }
string $title
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:

◆ doCreateMetaData()

ilObjTest::doCreateMetaData ( )
protected

Definition at line 4045 of file class.ilObjTest.php.

References saveAuthorToMetadata().

4045  : void
4046  {
4047  $this->saveAuthorToMetadata();
4048  }
saveAuthorToMetadata($author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
+ Here is the call graph for this function:

◆ duplicateQuestionForTest()

ilObjTest::duplicateQuestionForTest (   $question_id)

Takes a question and creates a copy of the question for use in the test.

Parameters
integer$question_idThe database id of the question
Returns
integer The database id of the copied question

Definition at line 1351 of file class.ilObjTest.php.

References _instanciateQuestion(), and ilObject\getId().

Referenced by insertQuestion().

1351  : int
1352  {
1353  $question = ilObjTest::_instanciateQuestion($question_id);
1354  $duplicate_id = $question->duplicate(true, '', '', -1, $this->getId());
1355  return $duplicate_id;
1356  }
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:

◆ endingTimeReached()

ilObjTest::endingTimeReached ( )

Returns true if the ending time of a test is reached An ending time is not available for self assessment tests.

Returns
boolean true if the ending time is reached, otherwise false public

Definition at line 2798 of file class.ilObjTest.php.

References getEndingTime(), and isEndingTimeEnabled().

Referenced by isExecutable().

2798  : bool
2799  {
2800  if ($this->isEndingTimeEnabled() && $this->getEndingTime() != 0) {
2801  $now = time();
2802  if ($now > $this->getEndingTime()) {
2803  return true;
2804  }
2805  }
2806  return false;
2807  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evalStatistical()

ilObjTest::evalStatistical (   $active_id)

Returns the statistical evaluation of the test for a specified user.

Definition at line 2149 of file class.ilObjTest.php.

References _getResultPass(), getMarkSchema(), getTestResult(), and null.

2149  : array
2150  {
2151  $pass = ilObjTest::_getResultPass($active_id);
2152  $test_result = &$this->getTestResult($active_id, $pass);
2153  $result = $this->db->queryF(
2154  "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
2155  ['integer'],
2156  [$active_id]
2157  );
2158  $times = [];
2159  $first_visit = 0;
2160  $last_visit = 0;
2161  while ($row = $this->db->fetchObject($result)) {
2162  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
2163  $epoch_1 = mktime(
2164  (int) $matches[4],
2165  (int) $matches[5],
2166  (int) $matches[6],
2167  (int) $matches[2],
2168  (int) $matches[3],
2169  (int) $matches[1]
2170  );
2171  if (!$first_visit) {
2172  $first_visit = $epoch_1;
2173  }
2174  if ($epoch_1 < $first_visit) {
2175  $first_visit = $epoch_1;
2176  }
2177  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
2178  $epoch_2 = mktime(
2179  (int) $matches[4],
2180  (int) $matches[5],
2181  (int) $matches[6],
2182  (int) $matches[2],
2183  (int) $matches[3],
2184  (int) $matches[1]
2185  );
2186  if (!$last_visit) {
2187  $last_visit = $epoch_2;
2188  }
2189  if ($epoch_2 > $last_visit) {
2190  $last_visit = $epoch_2;
2191  }
2192  $times[$row->active_fi] += ($epoch_2 - $epoch_1);
2193  }
2194  $max_time = 0;
2195  foreach ($times as $key => $value) {
2196  $max_time += $value;
2197  }
2198  if ((!$test_result["test"]["total_reached_points"]) or (!$test_result["test"]["total_max_points"])) {
2199  $percentage = 0.0;
2200  } else {
2201  $percentage = ($test_result["test"]["total_reached_points"] / $test_result["test"]["total_max_points"]) * 100.0;
2202  if ($percentage < 0) {
2203  $percentage = 0.0;
2204  }
2205  }
2206  $mark_obj = $this->getMarkSchema()->getMatchingMark($percentage);
2207  $first_date = getdate($first_visit);
2208  $last_date = getdate($last_visit);
2209  $qworkedthrough = 0;
2210  foreach ($test_result as $key => $value) {
2211  if (preg_match("/\d+/", $key)) {
2212  $qworkedthrough += $value["workedthrough"];
2213  }
2214  }
2215  if (!$qworkedthrough) {
2216  $atimeofwork = 0;
2217  } else {
2218  $atimeofwork = $max_time / $qworkedthrough;
2219  }
2220 
2221  $result_mark = "";
2222  $passed = "";
2223 
2224  if ($mark_obj !== null) {
2225  $result_mark = $mark_obj->getShortName();
2226 
2227  if ($mark_obj->getPassed()) {
2228  $passed = 1;
2229  } else {
2230  $passed = 0;
2231  }
2232  }
2233  $percent_worked_through = 0;
2234  if (count($this->questions)) {
2235  $percent_worked_through = $qworkedthrough / count($this->questions);
2236  }
2237  $result_array = [
2238  "qworkedthrough" => $qworkedthrough,
2239  "qmax" => count($this->questions),
2240  "pworkedthrough" => $percent_worked_through,
2241  "timeofwork" => $max_time,
2242  "atimeofwork" => $atimeofwork,
2243  "firstvisit" => $first_date,
2244  "lastvisit" => $last_date,
2245  "resultspoints" => $test_result["test"]["total_reached_points"],
2246  "maxpoints" => $test_result["test"]["total_max_points"],
2247  "resultsmarks" => $result_mark,
2248  "passed" => $passed,
2249  "distancemedian" => "0"
2250  ];
2251  foreach ($test_result as $key => $value) {
2252  if (preg_match("/\d+/", $key)) {
2253  $result_array[$key] = $value;
2254  }
2255  }
2256  return $result_array;
2257  }
getTestResult(int $active_id, ?int $pass=null, bool $ordered_sequence=false, bool $consider_hidden_questions=true, bool $consider_optional_questions=true)
Calculates the results of a test for a given user and returns an array with all test results...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
+ Here is the call graph for this function:

◆ evalTotalParticipantsArray()

ilObjTest::evalTotalParticipantsArray ( string  $name_sort_order = 'asc')

Definition at line 2356 of file class.ilObjTest.php.

References ANONYMOUS_USER_ID, getAnonymity(), getTestId(), and ILIAS\Repository\lng().

Referenced by getTotalPointsPassedArray().

2356  : array
2357  {
2358  $result = $this->db->queryF(
2359  'SELECT tst_active.user_fi, tst_active.active_id, usr_data.login, '
2360  . 'usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active '
2361  . 'LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id '
2362  . 'WHERE tst_active.test_fi = %s '
2363  . 'ORDER BY usr_data.lastname ' . strtoupper($name_sort_order),
2364  ['integer'],
2365  [$this->getTestId()]
2366  );
2367  $persons_array = [];
2368  while ($row = $this->db->fetchAssoc($result)) {
2369  if ($this->getAnonymity()) {
2370  $persons_array[$row['active_id']] = ['name' => $this->lng->txt("anonymous")];
2371  } else {
2372  if (strlen($row['firstname'] . $row['lastname'] . $row["title"]) == 0) {
2373  $persons_array[$row['active_id']] = ['name' => $this->lng->txt('deleted_user')];
2374  } else {
2375  if ($row['user_fi'] == ANONYMOUS_USER_ID) {
2376  $persons_array[$row['active_id']] = ['name' => $row['lastname']];
2377  } else {
2378  $persons_array[$row['active_id']] = [
2379  'name' => trim($row['lastname'] . ', ' . $row['firstname']
2380  . ' ' . $row['title']),
2381  'login' => $row['login']
2382  ];
2383  }
2384  }
2385  }
2386  }
2387  return $persons_array;
2388  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evalTotalPersons()

ilObjTest::evalTotalPersons ( )

Returns the number of persons who started the test.

Returns
integer The number of persons who started the test public

Definition at line 1973 of file class.ilObjTest.php.

References getTestId().

Referenced by marksEditable(), participantDataExist(), and saveToDb().

1973  : int
1974  {
1975  $result = $this->db->queryF(
1976  'SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s',
1977  ['integer'],
1978  [$this->getTestId()]
1979  );
1980  $row = $this->db->fetchAssoc($result);
1981  return $row['total'];
1982  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evalTotalPersonsArray()

ilObjTest::evalTotalPersonsArray ( string  $name_sort_order = 'asc')

Definition at line 2326 of file class.ilObjTest.php.

References ANONYMOUS_USER_ID, getAccessFilteredParticipantList(), getAnonymity(), getTestId(), and ILIAS\Repository\lng().

2326  : array
2327  {
2328  $result = $this->db->queryF(
2329  "SELECT tst_active.user_fi, tst_active.active_id, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
2330  ['integer'],
2331  [$this->getTestId()]
2332  );
2333  $persons_array = [];
2334  while ($row = $this->db->fetchAssoc($result)) {
2335  if ($this->getAccessFilteredParticipantList() && !$this->getAccessFilteredParticipantList()->isActiveIdInList($row["active_id"])) {
2336  continue;
2337  }
2338 
2339  if ($this->getAnonymity()) {
2340  $persons_array[$row["active_id"]] = $this->lng->txt("anonymous");
2341  } else {
2342  if (strlen($row["firstname"] . $row["lastname"] . $row["title"]) == 0) {
2343  $persons_array[$row["active_id"]] = $this->lng->txt("deleted_user");
2344  } else {
2345  if ($row["user_fi"] == ANONYMOUS_USER_ID) {
2346  $persons_array[$row["active_id"]] = $row["lastname"];
2347  } else {
2348  $persons_array[$row["active_id"]] = trim($row["lastname"] . ", " . $row["firstname"] . " " . $row["title"]);
2349  }
2350  }
2351  }
2352  }
2353  return $persons_array;
2354  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
getTestId()
Gets the database id of the additional test data.
getAccessFilteredParticipantList()
+ Here is the call graph for this function:

◆ evalTotalStartedAverageTime()

ilObjTest::evalTotalStartedAverageTime ( ?array  $active_ids_to_filter = null)

Definition at line 2583 of file class.ilObjTest.php.

References getTestId(), and null.

Referenced by getAggregatedResultsData(), and ILIAS\Test\Results\Data\Factory\getOverviewDataForTest().

2583  : int
2584  {
2585  $query = "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi";
2586 
2587  if ($active_ids_to_filter !== null && $active_ids_to_filter !== []) {
2588  $query .= " AND " . $this->db->in('active_id', $active_ids_to_filter, false, 'integer');
2589  }
2590 
2591  $result = $this->db->queryF($query, ['integer'], [$this->getTestId()]);
2592  $times = [];
2593  while ($row = $this->db->fetchObject($result)) {
2594  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
2595  $epoch_1 = mktime(
2596  (int) $matches[4],
2597  (int) $matches[5],
2598  (int) $matches[6],
2599  (int) $matches[2],
2600  (int) $matches[3],
2601  (int) $matches[1]
2602  );
2603  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
2604  $epoch_2 = mktime(
2605  (int) $matches[4],
2606  (int) $matches[5],
2607  (int) $matches[6],
2608  (int) $matches[2],
2609  (int) $matches[3],
2610  (int) $matches[1]
2611  );
2612  if (isset($times[$row->active_fi])) {
2613  $times[$row->active_fi] += ($epoch_2 - $epoch_1);
2614  } else {
2615  $times[$row->active_fi] = ($epoch_2 - $epoch_1);
2616  }
2617  }
2618  $max_time = 0;
2619  $counter = 0;
2620  foreach ($times as $value) {
2621  $max_time += $value;
2622  $counter++;
2623  }
2624  if ($counter === 0) {
2625  return 0;
2626  }
2627  return (int) round($max_time / $counter);
2628  }
getTestId()
Gets the database id of the additional test data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportFileItems()

ilObjTest::exportFileItems (   $target_dir,
$expLog 
)

export files of file itmes

Definition at line 3957 of file class.ilObjTest.php.

References IL_INST_ID, and ilFileUtils\makeDir().

Referenced by exportPagesXML().

3958  {
3959  foreach ($this->file_ids as $file_id) {
3960  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
3961  $file_dir = $target_dir . '/objects/il_' . IL_INST_ID . '_file_' . $file_id;
3962  ilFileUtils::makeDir($file_dir);
3963  $file_obj = new ilObjFile((int) $file_id, false);
3964  $source_file = $file_obj->getFile($file_obj->getVersion());
3965  if (!is_file($source_file)) {
3966  $source_file = $file_obj->getFile();
3967  }
3968  if (is_file($source_file)) {
3969  copy($source_file, $file_dir . '/' . $file_obj->getFileName());
3970  }
3971  unset($file_obj);
3972  }
3973  }
const IL_INST_ID
Definition: constants.php:40
Class ilObjFile.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPagesXML()

ilObjTest::exportPagesXML ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

export pages of test to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 3835 of file class.ilObjTest.php.

References exportFileItems(), exportXMLMediaObjects(), and exportXMLPageObjects().

3835  : void
3836  {
3837  $this->mob_ids = [];
3838 
3839  // PageObjects
3840  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Page Objects");
3841  $this->bench->start("ContentObjectExport", "exportPageObjects");
3842  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog);
3843  $this->bench->stop("ContentObjectExport", "exportPageObjects");
3844  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Page Objects");
3845 
3846  // MediaObjects
3847  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Media Objects");
3848  $this->bench->start("ContentObjectExport", "exportMediaObjects");
3849  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
3850  $this->bench->stop("ContentObjectExport", "exportMediaObjects");
3851  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Media Objects");
3852 
3853  // FileItems
3854  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export File Items");
3855  $this->bench->start("ContentObjectExport", "exportFileItems");
3856  $this->exportFileItems($a_target_dir, $expLog);
3857  $this->bench->stop("ContentObjectExport", "exportFileItems");
3858  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items");
3859  }
exportFileItems($target_dir, &$expLog)
export files of file itmes
exportXMLPageObjects(&$a_xml_writer, $inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
+ Here is the call graph for this function:

◆ exportXMLMediaObjects()

ilObjTest::exportXMLMediaObjects ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

export media objects to xml (see ilias_co.dtd)

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

References ilObjMediaObject\_exists(), ilFileUtils\createDirectory(), and IL_INST_ID.

Referenced by exportPagesXML().

3934  {
3935  foreach ($this->mob_ids as $mob_id) {
3936  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
3937  if (ilObjMediaObject::_exists((int) $mob_id)) {
3938  $target_dir = $a_target_dir . DIRECTORY_SEPARATOR . 'objects'
3939  . DIRECTORY_SEPARATOR . 'il_' . IL_INST_ID . '_mob_' . $mob_id;
3940  ilFileUtils::createDirectory($target_dir);
3941  $media_obj = new ilObjMediaObject((int) $mob_id);
3942  $media_obj->exportXML($a_xml_writer, (int) $a_inst);
3943  foreach ($media_obj->getMediaItems() as $item) {
3944  $stream = $item->getLocationStream();
3945  file_put_contents($target_dir . DIRECTORY_SEPARATOR . $item->getLocation(), $stream);
3946  $stream->close();
3947  }
3948  unset($media_obj);
3949  }
3950  }
3951  }
const IL_INST_ID
Definition: constants.php:40
static createDirectory(string $a_dir, int $a_mod=0755)
create directory
static _exists(int $id, bool $reference=false, ?string $type=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLPageObjects()

ilObjTest::exportXMLPageObjects ( $a_xml_writer,
  $inst,
$expLog 
)

export page objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 3882 of file class.ilObjTest.php.

References ilPCFileList\collectFileItems().

Referenced by exportPagesXML().

3883  {
3884  foreach ($this->questions as $question_id) {
3885  $this->bench->start("ContentObjectExport", "exportPageObject");
3886  $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $question_id);
3887 
3888  $attrs = [];
3889  $a_xml_writer->xmlStartTag("PageObject", $attrs);
3890 
3891 
3892  // export xml to writer object
3893  $this->bench->start("ContentObjectExport", "exportPageObject_XML");
3894  $page_object = new ilAssQuestionPage($question_id);
3895  $page_object->buildDom();
3896  $page_object->insertInstIntoIDs((string) $inst);
3897  $mob_ids = $page_object->collectMediaObjects(false);
3898  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
3899  $xml = $page_object->getXMLFromDom(false, false, false, "", true);
3900  $xml = str_replace("&", "&amp;", $xml);
3901  $a_xml_writer->appendXML($xml);
3902  $page_object->freeDom();
3903  unset($page_object);
3904 
3905  $this->bench->stop("ContentObjectExport", "exportPageObject_XML");
3906 
3907  // collect media objects
3908  $this->bench->start("ContentObjectExport", "exportPageObject_CollectMedia");
3909  //$mob_ids = $page_obj->getMediaObjectIDs();
3910  foreach ($mob_ids as $mob_id) {
3911  $this->mob_ids[$mob_id] = $mob_id;
3912  }
3913  $this->bench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
3914 
3915  // collect all file items
3916  $this->bench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
3917  //$file_ids = $page_obj->getFileItemIds();
3918  foreach ($file_ids as $file_id) {
3919  $this->file_ids[$file_id] = $file_id;
3920  }
3921  $this->bench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
3922 
3923  $a_xml_writer->xmlEndTag("PageObject");
3924  //unset($page_obj);
3925 
3926  $this->bench->stop("ContentObjectExport", "exportPageObject");
3927  }
3928  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjTest::fromXML ( ilQTIAssessment  $assessment,
array  $mappings 
)

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

Parameters
ilQTIAssessment$assessment

Definition at line 2894 of file class.ilObjTest.php.

References $main_settings, $metadata, $objectives, $score_settings, addConcludingRemarksToSettingsFromImport(), addIntroductionToSettingsFromImport(), addToNewsOnOnline(), buildDateTimeImmutableFromPeriod(), ILIAS\TestQuestionPool\Import\buildImportDirectoryFromImportFile(), ilSession\clear(), ilSession\get(), ILIAS\Test\Settings\MainSettings\MainSettings\getAccessSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getAdditionalSettings(), ilQTIAssessment\getComment(), ILIAS\Test\Settings\MainSettings\MainSettings\getFinishingSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getGamificationSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getGeneralSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getIntroductionSettings(), getMainSettings(), getMainSettingsRepository(), getMarkSchema(), ilObject\getObjectProperties(), ILIAS\Test\Settings\MainSettings\MainSettings\getParticipantFunctionalitySettings(), ilQTIAssessment\getPresentationMaterial(), ILIAS\Test\Settings\MainSettings\MainSettings\getQuestionBehaviourSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultDetailsSettings(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getResultSummarySettings(), getScoreSettings(), getScoreSettingsRepository(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\getScoringSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getTestBehaviourSettings(), ilQTIAssessment\getTitle(), loadFromDb(), null, qtiMaterialToArray(), saveAuthorToMetadata(), saveToDb(), setActivationEndingTime(), setActivationLimited(), setActivationStartingTime(), setActivationVisibility(), ILIAS\Test\Settings\ScoreReporting\ScoreSettings\withGamificationSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\withGeneralSettings(), and ILIAS\GlobalScreen\Scope\Footer\Factory\withTitle().

2894  : void
2895  {
2896  if (($importdir = ilSession::get('path_to_container_import_file')) === null) {
2897  $importdir = $this->buildImportDirectoryFromImportFile(ilSession::get('path_to_import_file'));
2898  }
2899  ilSession::clear('path_to_container_import_file');
2900  ilSession::clear('import_mob_xhtml');
2901 
2902  $this->saveToDb(true);
2903 
2904  $main_settings = $this->getMainSettings();
2905  $general_settings = $main_settings->getGeneralSettings();
2906  $introduction_settings = $main_settings->getIntroductionSettings();
2907  $access_settings = $main_settings->getAccessSettings();
2908  $test_behaviour_settings = $main_settings->getTestBehaviourSettings();
2909  $question_behaviour_settings = $main_settings->getQuestionBehaviourSettings();
2910  $participant_functionality_settings = $main_settings->getParticipantFunctionalitySettings();
2911  $finishing_settings = $main_settings->getFinishingSettings();
2912  $additional_settings = $main_settings->getAdditionalSettings();
2913 
2914  $introduction_settings = $introduction_settings->withIntroductionEnabled(false);
2915  foreach ($assessment->objectives as $objectives) {
2916  foreach ($objectives->materials as $material) {
2917  $introduction_settings = $this->addIntroductionToSettingsFromImport(
2918  $introduction_settings,
2919  $this->qtiMaterialToArray($material),
2920  $importdir,
2921  $mappings
2922  );
2923  }
2924  }
2925 
2926  if ($assessment->getPresentationMaterial()
2927  && $assessment->getPresentationMaterial()->getFlowMat(0)
2928  && $assessment->getPresentationMaterial()->getFlowMat(0)->getMaterial(0)) {
2929  $finishing_settings = $this->addConcludingRemarksToSettingsFromImport(
2930  $finishing_settings,
2931  $this->qtiMaterialToArray(
2932  $assessment->getPresentationMaterial()->getFlowMat(0)->getMaterial(0)
2933  ),
2934  $importdir,
2935  $mappings
2936  );
2937  }
2938 
2939  $score_settings = $this->getScoreSettings();
2940  $scoring_settings = $score_settings->getScoringSettings();
2941  $gamification_settings = $score_settings->getGamificationSettings();
2942  $result_summary_settings = $score_settings->getResultSummarySettings();
2943  $result_details_settings = $score_settings->getResultDetailsSettings();
2944 
2945  $mark_steps = [];
2946  foreach ($assessment->qtimetadata as $metadata) {
2947  switch ($metadata["label"]) {
2948  case "solution_details":
2949  $result_details_settings = $result_details_settings->withShowPassDetails((bool) $metadata["entry"]);
2950  break;
2951  case "show_solution_list_comparison":
2952  $result_details_settings = $result_details_settings->withShowSolutionListComparison((bool) $metadata["entry"]);
2953  break;
2954  case "print_bs_with_res":
2955  $result_details_settings = $result_details_settings->withShowSolutionListComparison((bool) $metadata["entry"]);
2956  break;
2957  case "author":
2958  $this->saveAuthorToMetadata($metadata["entry"]);
2959  break;
2960  case "nr_of_tries":
2961  $test_behaviour_settings = $test_behaviour_settings->withNumberOfTries((int) $metadata["entry"]);
2962  break;
2963  case 'block_after_passed':
2964  $test_behaviour_settings = $test_behaviour_settings->withBlockAfterPassedEnabled((bool) $metadata['entry']);
2965  break;
2966  case "pass_waiting":
2967  $test_behaviour_settings = $test_behaviour_settings->withPassWaiting($metadata["entry"]);
2968  break;
2969  case "kiosk":
2970  $test_behaviour_settings = $test_behaviour_settings->withKioskMode((int) $metadata["entry"]);
2971  break;
2972  case 'show_introduction':
2973  $introduction_settings = $introduction_settings->withIntroductionEnabled((bool) $metadata['entry']);
2974  // no break
2975  case "showfinalstatement":
2976  case 'show_concluding_remarks':
2977  $finishing_settings = $finishing_settings->withConcludingRemarksEnabled((bool) $metadata["entry"]);
2978  break;
2979  case "highscore_enabled":
2980  $gamification_settings = $gamification_settings->withHighscoreEnabled((bool) $metadata["entry"]);
2981  break;
2982 
2983  case "highscore_anon":
2984  $gamification_settings = $gamification_settings->withHighscoreAnon((bool) $metadata["entry"]);
2985  break;
2986 
2987  case "highscore_achieved_ts":
2988  $gamification_settings = $gamification_settings->withHighscoreAchievedTS((bool) $metadata["entry"]);
2989  break;
2990 
2991  case "highscore_score":
2992  $gamification_settings = $gamification_settings->withHighscoreScore((bool) $metadata["entry"]);
2993  break;
2994 
2995  case "highscore_percentage":
2996  $gamification_settings = $gamification_settings->withHighscorePercentage((bool) $metadata["entry"]);
2997  break;
2998 
2999  case "highscore_hints":
3000  $gamification_settings = $gamification_settings->withHighscoreHints((bool) $metadata["entry"]);
3001  break;
3002 
3003  case "highscore_wtime":
3004  $gamification_settings = $gamification_settings->withHighscoreWTime((bool) $metadata["entry"]);
3005  break;
3006 
3007  case "highscore_own_table":
3008  $gamification_settings = $gamification_settings->withHighscoreOwnTable((bool) $metadata["entry"]);
3009  break;
3010 
3011  case "highscore_top_table":
3012  $gamification_settings = $gamification_settings->withHighscoreTopTable((bool) $metadata["entry"]);
3013  break;
3014 
3015  case "highscore_top_num":
3016  $gamification_settings = $gamification_settings->withHighscoreTopNum((int) $metadata["entry"]);
3017  break;
3018  case "use_previous_answers":
3019  $participant_functionality_settings = $participant_functionality_settings->withUsePreviousAnswerAllowed((bool) $metadata["entry"]);
3020  break;
3021  case "title_output":
3022  $question_behaviour_settings = $question_behaviour_settings->withQuestionTitleOutputMode((int) $metadata["entry"]);
3023  break;
3024  case "question_set_type":
3025  $general_settings = $general_settings->withQuestionSetType($metadata["entry"]);
3026  break;
3027  case "anonymity":
3028  $general_settings = $general_settings->withAnonymity((bool) $metadata["entry"]);
3029  break;
3030  case "results_presentation":
3031  $result_details_settings = $result_details_settings->withResultsPresentation((int) $metadata["entry"]);
3032  break;
3033  case "reset_processing_time":
3034  $test_behaviour_settings = $test_behaviour_settings->withResetProcessingTime((bool) $metadata["entry"]);
3035  break;
3036  case "answer_feedback_points":
3037  $question_behaviour_settings = $question_behaviour_settings->withInstantFeedbackPointsEnabled((bool) $metadata["entry"]);
3038  break;
3039  case "answer_feedback":
3040  $question_behaviour_settings = $question_behaviour_settings->withInstantFeedbackGenericEnabled((bool) $metadata["entry"]);
3041  break;
3042  case 'instant_feedback_specific':
3043  $question_behaviour_settings = $question_behaviour_settings->withInstantFeedbackSpecificEnabled((bool) $metadata['entry']);
3044  break;
3045  case "instant_verification":
3046  $question_behaviour_settings = $question_behaviour_settings->withInstantFeedbackSolutionEnabled((bool) $metadata["entry"]);
3047  break;
3048  case "force_instant_feedback":
3049  $question_behaviour_settings = $question_behaviour_settings->withForceInstantFeedbackOnNextQuestion((bool) $metadata["entry"]);
3050  break;
3051  case "follow_qst_answer_fixation":
3052  $question_behaviour_settings = $question_behaviour_settings->withLockAnswerOnNextQuestionEnabled((bool) $metadata["entry"]);
3053  break;
3054  case "instant_feedback_answer_fixation":
3055  $question_behaviour_settings = $question_behaviour_settings->withLockAnswerOnInstantFeedbackEnabled((bool) $metadata["entry"]);
3056  break;
3057  case "show_cancel":
3058  case "suspend_test_allowed":
3059  $participant_functionality_settings = $participant_functionality_settings->withSuspendTestAllowed((bool) $metadata["entry"]);
3060  break;
3061  case "sequence_settings":
3062  $participant_functionality_settings = $participant_functionality_settings->withPostponedQuestionsMoveToEnd((bool) $metadata["entry"]);
3063  break;
3064  case "show_marker":
3065  $participant_functionality_settings = $participant_functionality_settings->withQuestionMarkingEnabled((bool) $metadata["entry"]);
3066  break;
3067  case "fixed_participants":
3068  $access_settings = $access_settings->withFixedParticipants((bool) $metadata["entry"]);
3069  break;
3070  case "score_reporting":
3071  if ($metadata['entry'] !== null) {
3072  $result_summary_settings = $result_summary_settings->withScoreReporting(
3073  ScoreReportingTypes::tryFrom((int) $metadata['entry']) ?? ScoreReportingTypes::SCORE_REPORTING_DISABLED
3074  );
3075  }
3076  break;
3077  case "shuffle_questions":
3078  $question_behaviour_settings = $question_behaviour_settings->withShuffleQuestions((bool) $metadata["entry"]);
3079  break;
3080  case "count_system":
3081  $scoring_settings = $scoring_settings->withCountSystem((int) $metadata["entry"]);
3082  break;
3083  case "mailnotification":
3084  $finishing_settings = $finishing_settings->withMailNotificationContentType((int) $metadata["entry"]);
3085  break;
3086  case "mailnottype":
3087  $finishing_settings = $finishing_settings->withAlwaysSendMailNotification((bool) $metadata["entry"]);
3088  break;
3089  case "exportsettings":
3090  $result_details_settings = $result_details_settings->withExportSettings((int) $metadata["entry"]);
3091  break;
3092  case "score_cutting":
3093  $scoring_settings = $scoring_settings->withScoreCutting((int) $metadata["entry"]);
3094  break;
3095  case "password":
3096  $access_settings = $access_settings->withPasswordEnabled(
3097  $metadata["entry"] !== null && $metadata["entry"] !== ''
3098  )->withPassword($metadata["entry"]);
3099  break;
3100  case 'ip_range_from':
3101  if ($metadata['entry'] !== '') {
3102  $access_settings = $access_settings->withIpRangeFrom($metadata['entry']);
3103  }
3104  break;
3105  case 'ip_range_to':
3106  if ($metadata['entry'] !== '') {
3107  $access_settings = $access_settings->withIpRangeTo($metadata['entry']);
3108  }
3109  break;
3110  case "pass_scoring":
3111  $scoring_settings = $scoring_settings->withPassScoring((int) $metadata["entry"]);
3112  break;
3113  case 'pass_deletion_allowed':
3114  $result_summary_settings = $result_summary_settings->withPassDeletionAllowed((bool) $metadata["entry"]);
3115  break;
3116  case "usr_pass_overview_mode":
3117  $participant_functionality_settings = $participant_functionality_settings->withUsrPassOverviewMode((int) $metadata["entry"]);
3118  break;
3119  case "question_list":
3120  $participant_functionality_settings = $participant_functionality_settings->withQuestionListEnabled((bool) $metadata["entry"]);
3121  break;
3122 
3123  case "reporting_date":
3124  $reporting_date = $this->buildDateTimeImmutableFromPeriod($metadata['entry']);
3125  if ($reporting_date !== null) {
3126  $result_summary_settings = $result_summary_settings->withReportingDate($reporting_date);
3127  }
3128  break;
3129  case 'enable_processing_time':
3130  $test_behaviour_settings = $test_behaviour_settings->withProcessingTimeEnabled((bool) $metadata['entry']);
3131  break;
3132  case "processing_time":
3133  $test_behaviour_settings = $test_behaviour_settings->withProcessingTime($metadata['entry']);
3134  break;
3135  case "starting_time":
3136  $starting_time = $this->buildDateTimeImmutableFromPeriod($metadata['entry']);
3137  if ($starting_time !== null) {
3138  $access_settings = $access_settings->withStartTime($starting_time)
3139  ->withStartTimeEnabled(true);
3140  }
3141  break;
3142  case "ending_time":
3143  $ending_time = $this->buildDateTimeImmutableFromPeriod($metadata['entry']);
3144  if ($ending_time !== null) {
3145  $access_settings = $access_settings->withEndTime($ending_time)
3146  ->withStartTimeEnabled(true);
3147  }
3148  break;
3149  case "enable_examview":
3150  $finishing_settings = $finishing_settings->withShowAnswerOverview((bool) $metadata["entry"]);
3151  break;
3152  case 'redirection_mode':
3153  $finishing_settings = $finishing_settings->withRedirectionMode((int) $metadata['entry']);
3154  break;
3155  case 'redirection_url':
3156  $finishing_settings = $finishing_settings->withRedirectionUrl($metadata['entry']);
3157  break;
3158  case 'examid_in_test_pass':
3159  $test_behaviour_settings = $test_behaviour_settings->withExamIdInTestAttemptEnabled((bool) $metadata['entry']);
3160  break;
3161  case 'examid_in_test_res':
3162  $result_details_settings = $result_details_settings->withShowExamIdInTestResults((bool) $metadata["entry"]);
3163  break;
3164  case 'skill_service':
3165  $additional_settings = $additional_settings->withSkillsServiceEnabled((bool) $metadata['entry']);
3166  break;
3167  case 'show_grading_status':
3168  $result_summary_settings = $result_summary_settings->withShowGradingStatusEnabled((bool) $metadata["entry"]);
3169  break;
3170  case 'show_grading_mark':
3171  $result_summary_settings = $result_summary_settings->withShowGradingMarkEnabled((bool) $metadata["entry"]);
3172  break;
3173  case 'activation_limited':
3174  $this->setActivationLimited((bool) $metadata['entry']);
3175  break;
3176  case 'activation_start_time':
3177  $this->setActivationStartingTime($metadata['entry'] !== 'null' ? (int) $metadata['entry'] : null);
3178  break;
3179  case 'activation_end_time':
3180  $this->setActivationEndingTime($metadata['entry'] !== 'null' ? (int) $metadata['entry'] : null);
3181  break;
3182  case 'activation_visibility':
3183  $this->setActivationVisibility($metadata['entry']);
3184  break;
3185  case 'autosave':
3186  $question_behaviour_settings = $question_behaviour_settings->withAutosaveEnabled((bool) $metadata['entry']);
3187  break;
3188  case 'autosave_ival':
3189  $question_behaviour_settings = $question_behaviour_settings->withAutosaveInterval((int) $metadata['entry']);
3190  break;
3191  case 'offer_question_hints':
3192  $question_behaviour_settings = $question_behaviour_settings->withQuestionHintsEnabled((bool) $metadata['entry']);
3193  break;
3194  case 'show_summary':
3195  $participant_functionality_settings = $participant_functionality_settings->withQuestionListEnabled(($metadata['entry'] & 1) > 0)
3196  ->withUsrPassOverviewMode((int) $metadata['entry']);
3197  }
3198  if (preg_match("/mark_step_\d+/", $metadata["label"])) {
3199  $xmlmark = $metadata["entry"];
3200  preg_match("/<short>(.*?)<\/short>/", $xmlmark, $matches);
3201  $mark_short = $matches[1];
3202  preg_match("/<official>(.*?)<\/official>/", $xmlmark, $matches);
3203  $mark_official = $matches[1];
3204  preg_match("/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
3205  $mark_percentage = (float) $matches[1];
3206  preg_match("/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
3207  $mark_passed = (bool) $matches[1];
3208  $mark_steps[] = new Mark($mark_short, $mark_official, $mark_percentage, $mark_passed);
3209  }
3210  }
3211  $this->mark_schema = $this->getMarkSchema()->withMarkSteps($mark_steps);
3212  $this->saveToDb();
3213  $this->getObjectProperties()->storePropertyTitleAndDescription(
3214  $this->getObjectProperties()->getPropertyTitleAndDescription()
3215  ->withTitle($assessment->getTitle())
3216  ->withDescription($assessment->getComment())
3217  );
3218  $this->addToNewsOnOnline(false, $this->getObjectProperties()->getPropertyIsOnline()->getIsOnline());
3220  ->withGeneralSettings($general_settings)
3221  ->withIntroductionSettings($introduction_settings)
3222  ->withAccessSettings($access_settings)
3223  ->withParticipantFunctionalitySettings($participant_functionality_settings)
3224  ->withTestBehaviourSettings($test_behaviour_settings)
3225  ->withQuestionBehaviourSettings($question_behaviour_settings)
3226  ->withFinishingSettings($finishing_settings)
3227  ->withAdditionalSettings($additional_settings);
3228  $this->getMainSettingsRepository()->store($main_settings);
3229  $this->main_settings = $main_settings;
3230 
3232  ->withGamificationSettings($gamification_settings)
3233  ->withScoringSettings($scoring_settings)
3234  ->withResultDetailsSettings($result_details_settings)
3235  ->withResultSummarySettings($result_summary_settings);
3237  $this->score_settings = $score_settings;
3238  $this->loadFromDb();
3239  }
addConcludingRemarksToSettingsFromImport(SettingsFinishing $settings, array $material, string $importdir, array $mappings)
withGamificationSettings(SettingsGamification $settings)
static get(string $a_var)
A class defining marks for assessment test objects.
Definition: Mark.php:35
setActivationStartingTime(?int $starting_time=null)
qtiMaterialToArray($a_material)
Reads an QTI material tag and creates a text string.
buildDateTimeImmutableFromPeriod(?string $period)
setActivationLimited($a_value)
setActivationEndingTime(?int $ending_time=null)
saveToDb(bool $properties_only=false)
withGeneralSettings(SettingsGeneral $settings)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$objectives
$metadata
A reference to an IMS compatible matadata set.
setActivationVisibility($a_value)
MainSettings $main_settings
buildImportDirectoryFromImportFile(string $file_to_import)
addIntroductionToSettingsFromImport(SettingsIntroduction $settings, array $material, string $importdir, array $mappings)
addToNewsOnOnline(bool $old_online_status, bool $new_online_status)
ScoreSettings $score_settings
saveAuthorToMetadata($author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
getScoreSettingsRepository()
static clear(string $a_var)
+ Here is the call graph for this function:

◆ getAccessFilteredParticipantList()

ilObjTest::getAccessFilteredParticipantList ( )

Definition at line 2457 of file class.ilObjTest.php.

References $access_filtered_participant_list.

Referenced by evalTotalPersonsArray(), and getParticipantsForTestAndQuestion().

2458  {
2460  }
ilTestParticipantList $access_filtered_participant_list
+ Here is the caller graph for this function:

◆ getActivationEndingTime()

ilObjTest::getActivationEndingTime ( )

Definition at line 6917 of file class.ilObjTest.php.

References $activation_ending_time.

Referenced by addDefaults(), saveToDb(), and toXML().

6917  : ?int
6918  {
6920  }
int $activation_ending_time
+ Here is the caller graph for this function:

◆ getActivationStartingTime()

ilObjTest::getActivationStartingTime ( )

Definition at line 6912 of file class.ilObjTest.php.

References $activation_starting_time.

Referenced by addDefaults(), saveToDb(), and toXML().

6912  : ?int
6913  {
6915  }
int $activation_starting_time
+ Here is the caller graph for this function:

◆ getActivationVisibility()

ilObjTest::getActivationVisibility ( )

Definition at line 6699 of file class.ilObjTest.php.

References $activation_visibility.

Referenced by addDefaults(), saveToDb(), and toXML().

6699  : bool
6700  {
6702  }
bool $activation_visibility
+ Here is the caller graph for this function:

◆ getActiveIdOfUser()

ilObjTest::getActiveIdOfUser (   $user_id = "",
  $anonymous_id = "" 
)

Gets the active id of a given user.

Parameters
integer$user_idThe database id of the user
string$anonymous_idThe anonymous id if the test is an anonymized test
Returns
integer The active ID public

Definition at line 1699 of file class.ilObjTest.php.

References $user_id, ANONYMOUS_USER_ID, ilSession\get(), getTestId(), null, and ILIAS\Repository\user().

Referenced by getAllQuestions(), getExistingQuestions(), isExecutable(), loadQuestions(), ilCourseObjectiveResult\resetTestForUser(), and setQuestionSetSolved().

1699  : ?int
1700  {
1701  if (!$user_id) {
1702  $user_id = $this->user->getId();
1703  }
1704 
1705  $tst_access_code = ilSession::get('tst_access_code');
1706  if (is_array($tst_access_code) &&
1707  $this->user->getId() === ANONYMOUS_USER_ID &&
1708  isset($tst_access_code[$this->getTestId()]) &&
1709  $tst_access_code[$this->getTestId()] !== '') {
1710  $result = $this->db->queryF(
1711  'SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s',
1712  ['integer', 'integer', 'text'],
1713  [$user_id, $this->test_id, $tst_access_code[$this->getTestId()]]
1714  );
1715  } elseif ((string) $anonymous_id !== '') {
1716  $result = $this->db->queryF(
1717  'SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s',
1718  ['integer', 'integer', 'text'],
1719  [$user_id, $this->test_id, $anonymous_id]
1720  );
1721  } else {
1722  if ((int) $user_id === ANONYMOUS_USER_ID) {
1723  return null;
1724  }
1725  $result = $this->db->queryF(
1726  'SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s',
1727  ['integer', 'integer'],
1728  [$user_id, $this->test_id]
1729  );
1730  }
1731 
1732  if ($result->numRows()) {
1733  $row = $this->db->fetchAssoc($result);
1734  return (int) $row['active_id'];
1735  }
1736 
1737  return null;
1738  }
static get(string $a_var)
const ANONYMOUS_USER_ID
Definition: constants.php:27
getTestId()
Gets the database id of the additional test data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveParticipantList()

ilObjTest::getActiveParticipantList ( )

Definition at line 4371 of file class.ilObjTest.php.

References getTestParticipants(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

4372  {
4373  $participant_list = new ilTestParticipantList($this, $this->user, $this->lng, $this->db);
4374  $participant_list->initializeFromDbRows($this->getTestParticipants());
4375 
4376  return $participant_list;
4377  }
+ Here is the call graph for this function:

◆ getAggregatedResultsData()

ilObjTest::getAggregatedResultsData ( )

Definition at line 6398 of file class.ilObjTest.php.

References $data, $results, evalTotalStartedAverageTime(), getCompleteEvaluationData(), ILIAS\Repository\lng(), and secondsToHoursMinutesSecondsString().

6398  : array
6399  {
6400  $data = $this->getCompleteEvaluationData();
6401  $found_participants = $data->getParticipants();
6402  $results = ['overview' => [], 'questions' => []];
6403  if ($found_participants !== []) {
6404  $results['overview']['tst_stat_result_mark_median'] = $data->getStatistics()->getEvaluationDataOfMedianUser()?->getMark()?->getShortName() ?? '';
6405  $results['overview']['tst_stat_result_rank_median'] = $data->getStatistics()->rankMedian();
6406  $results['overview']['tst_stat_result_total_participants'] = $data->getStatistics()->count();
6407  $results['overview']['tst_stat_result_median'] = $data->getStatistics()->median();
6408  $results['overview']['tst_eval_total_persons'] = count($found_participants);
6409  $total_finished = $data->getTotalFinishedParticipants();
6410  $results['overview']['tst_eval_total_finished'] = $total_finished;
6411  $results['overview']['tst_eval_total_finished_average_time'] =
6413  $this->evalTotalStartedAverageTime($data->getParticipantIds())
6414  );
6415  $total_passed = 0;
6416  $total_passed_reached = 0;
6417  $total_passed_max = 0;
6418  $total_passed_time = 0;
6419  foreach ($found_participants as $userdata) {
6420  if ($userdata->getMark()?->getPassed()) {
6421  $total_passed++;
6422  $total_passed_reached += $userdata->getReached();
6423  $total_passed_max += $userdata->getMaxpoints();
6424  $total_passed_time += $userdata->getTimeOnTask();
6425  }
6426  }
6427  $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
6428  $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
6429  $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
6430  $results['overview']['tst_eval_total_passed'] = $total_passed;
6431  $results['overview']['tst_eval_total_passed_average_points'] = sprintf('%2.2f', $average_passed_reached)
6432  . ' ' . strtolower('of') . ' ' . sprintf('%2.2f', $average_passed_max);
6433  $results['overview']['tst_eval_total_passed_average_time'] =
6434  $this->secondsToHoursMinutesSecondsString($average_passed_time);
6435  }
6436 
6437  foreach ($data->getQuestionTitles() as $question_id => $question_title) {
6438  $answered = 0;
6439  $reached = 0;
6440  $max = 0;
6441  foreach ($found_participants as $userdata) {
6442  for ($i = 0; $i <= $userdata->getLastPass(); $i++) {
6443  if (is_object($userdata->getPass($i))) {
6444  $question = $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
6445  if (is_array($question)) {
6446  $answered++;
6447  $reached += $question['reached'];
6448  $max += $question['points'];
6449  }
6450  }
6451  }
6452  }
6453  $percent = $max ? $reached / $max * 100.0 : 0;
6454  $results['questions'][$question_id] = [
6455  $question_title,
6456  sprintf('%.2f', $answered ? $reached / $answered : 0) . ' ' . strtolower($this->lng->txt('of')) . ' ' . sprintf('%.2f', $answered ? $max / $answered : 0),
6457  sprintf('%.2f', $percent) . '%',
6458  $answered,
6459  sprintf('%.2f', $answered ? $reached / $answered : 0),
6460  sprintf('%.2f', $answered ? $max / $answered : 0),
6461  $percent / 100.0
6462  ];
6463  }
6464  return $results;
6465  }
evalTotalStartedAverageTime(?array $active_ids_to_filter=null)
secondsToHoursMinutesSecondsString(int $seconds)
$results
getCompleteEvaluationData($filterby='', $filtertext='')
+ Here is the call graph for this function:

◆ getAllQuestions()

ilObjTest::getAllQuestions (   $pass = null)

Returns all questions of a test in test order.

Returns
array An array containing the id's as keys and the database row objects as values public

Definition at line 1659 of file class.ilObjTest.php.

References getActiveIdOfUser(), isRandomTest(), loadQuestions(), null, and ILIAS\Repository\user().

1659  : array
1660  {
1661  if ($this->isRandomTest()) {
1662  $active_id = $this->getActiveIdOfUser($this->user->getId());
1663  if ($active_id === null) {
1664  return [];
1665  }
1666  $this->loadQuestions($active_id, $pass);
1667  if (count($this->questions) === 0) {
1668  return [];
1669  }
1670  if (is_null($pass)) {
1671  $pass = self::_getPass($active_id);
1672  }
1673  $result = $this->db->queryF(
1674  "SELECT qpl_questions.* FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s AND " . $this->db->in('qpl_questions.question_id', $this->questions, false, 'integer'),
1675  ['integer','integer'],
1676  [$active_id, $pass]
1677  );
1678  } else {
1679  if (count($this->questions) === 0) {
1680  return [];
1681  }
1682  $result = $this->db->query("SELECT qpl_questions.* FROM qpl_questions, tst_test_question WHERE tst_test_question.question_fi = qpl_questions.question_id AND " . $this->db->in('qpl_questions.question_id', $this->questions, false, 'integer'));
1683  }
1684  $result_array = [];
1685  while ($row = $this->db->fetchAssoc($result)) {
1686  $result_array[$row["question_id"]] = $row;
1687  }
1688  return $result_array;
1689  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getAllTestResults()

ilObjTest::getAllTestResults (   $participants)

returns all test results for all participants

Parameters
array$partipantsarray of user ids
Returns
array of fields, see code for column titles

Definition at line 4711 of file class.ilObjTest.php.

References $results, _getResultPass(), _instanciateQuestion(), getAnonymity(), getMarkSchema(), ILIAS\Repository\lng(), and null.

4711  : array
4712  {
4713  $results = [];
4714  $row = [
4715  "user_id" => $this->lng->txt("user_id"),
4716  "matriculation" => $this->lng->txt("matriculation"),
4717  "lastname" => $this->lng->txt("lastname"),
4718  "firstname" => $this->lng->txt("firstname"),
4719  "login" => $this->lng->txt("login"),
4720  "reached_points" => $this->lng->txt("tst_reached_points"),
4721  "max_points" => $this->lng->txt("tst_maximum_points"),
4722  "percent_value" => $this->lng->txt("tst_percent_solved"),
4723  "mark" => $this->lng->txt("tst_mark"),
4724  "passed" => $this->lng->txt("tst_mark_passed"),
4725  ];
4726  $results[] = $row;
4727  if (count($participants)) {
4728  foreach ($participants as $active_id => $user_rec) {
4729  $mark = '';
4730  $row = [];
4731  $reached_points = 0;
4732  $max_points = 0;
4733  $pass = ilObjTest::_getResultPass($active_id);
4734  // abort if no valid pass can be found
4735  if (!is_int($pass)) {
4736  continue;
4737  }
4738  foreach ($this->questions as $value) {
4739  $question = ilObjTest::_instanciateQuestion($value);
4740  if (is_object($question)) {
4741  $max_points += $question->getMaximumPoints();
4742  $reached_points += $question->getReachedPoints($active_id, $pass);
4743  }
4744  }
4745  if ($max_points > 0) {
4746  $percentvalue = $reached_points / $max_points;
4747  if ($percentvalue < 0) {
4748  $percentvalue = 0.0;
4749  }
4750  } else {
4751  $percentvalue = 0;
4752  }
4753  $mark_obj = $this->getMarkSchema()->getMatchingMark($percentvalue * 100);
4754  $passed = "";
4755  if ($mark_obj !== null) {
4756  $mark = $mark_obj->getOfficialName();
4757  }
4758  if ($this->getAnonymity()) {
4759  $user_rec['firstname'] = "";
4760  $user_rec['lastname'] = $this->lng->txt("anonymous");
4761  }
4762  $results[] = [
4763  "user_id" => $user_rec['usr_id'],
4764  "matriculation" => $user_rec['matriculation'],
4765  "lastname" => $user_rec['lastname'],
4766  "firstname" => $user_rec['firstname'],
4767  "login" => $user_rec['login'],
4768  "reached_points" => $reached_points,
4769  "max_points" => $max_points,
4770  "percent_value" => $percentvalue,
4771  "mark" => $mark,
4772  "passed" => $user_rec['passed'] ? '1' : '0',
4773  ];
4774  }
4775  }
4776  return $results;
4777  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
$results
+ Here is the call graph for this function:

◆ getAnonymity()

ilObjTest::getAnonymity ( )

Definition at line 5542 of file class.ilObjTest.php.

References getMainSettings().

Referenced by buildName(), evalTotalParticipantsArray(), evalTotalPersonsArray(), getAllTestResults(), getDetailedTestResults(), getInvitedUsers(), getParticipants(), ilTestArchiver\getResultsOfUserOutput(), getTestParticipants(), getUserData(), isHighscoreAnon(), and userLookupFullName().

5542  : bool
5543  {
5544  return $this->getMainSettings()->getGeneralSettings()->getAnonymity();
5545  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnsweredQuestionCount()

ilObjTest::getAnsweredQuestionCount (   $active_id,
  $pass = null 
)

Retrieves the number of answered questions for a given user in a given test.

Parameters
integer$user_idThe user id
integer$test_idThe test id
integer$passThe pass of the test (optional)
Returns
integer The number of answered questions public

Definition at line 4901 of file class.ilObjTest.php.

References isRandomTest(), and loadQuestions().

4901  : int
4902  {
4903  if ($this->isRandomTest()) {
4904  $this->loadQuestions($active_id, $pass);
4905  }
4906  $workedthrough = 0;
4907  foreach ($this->questions as $value) {
4908  if ($this->questionrepository->lookupResultRecordExist($active_id, $value, $pass)) {
4909  $workedthrough += 1;
4910  }
4911  }
4912  return $workedthrough;
4913  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:

◆ getAnswerFeedbackPoints()

ilObjTest::getAnswerFeedbackPoints ( )

Definition at line 746 of file class.ilObjTest.php.

References getMainSettings().

746  : bool
747  {
748  return $this->getMainSettings()->getQuestionBehaviourSettings()->getInstantFeedbackPointsEnabled();
749  }
+ Here is the call graph for this function:

◆ getAuthor()

ilObjTest::getAuthor ( )

Gets the authors name of the ilObjTest object.

Returns
string The string containing the name of the test author public
See also
$author

Definition at line 4057 of file class.ilObjTest.php.

References ilObject\getId(), and ilObject\getType().

Referenced by toXML().

4057  : string
4058  {
4059  $path_to_authors = $this->lo_metadata->paths()->authors();
4060  $author_data = $this->lo_metadata->read($this->getId(), 0, $this->getType(), $path_to_authors)
4061  ->allData($path_to_authors);
4062 
4063  return $this->lo_metadata->dataHelper()->makePresentableAsList(', ', ...$author_data);
4064  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAutosave()

ilObjTest::getAutosave ( )

Definition at line 6887 of file class.ilObjTest.php.

References getMainSettings().

Referenced by ILIAS\Test\Results\Data\Factory\buildAttemptResults().

6887  : bool
6888  {
6889  return $this->getMainSettings()->getQuestionBehaviourSettings()->getAutosaveEnabled();
6890  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableDefaults()

ilObjTest::getAvailableDefaults ( )

Returns the available test defaults for the active user.

Returns
array An array containing the defaults public

Definition at line 5630 of file class.ilObjTest.php.

References ILIAS\Repository\user().

5630  : array
5631  {
5632  $result = $this->db->queryF(
5633  "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
5634  ['integer'],
5635  [$this->user->getId()]
5636  );
5637  $defaults = [];
5638  while ($row = $this->db->fetchAssoc($result)) {
5639  $defaults[$row["test_defaults_id"]] = $row;
5640  }
5641  return $defaults;
5642  }
+ Here is the call graph for this function:

◆ getAvailableQuestionpools()

ilObjTest::getAvailableQuestionpools ( bool  $use_object_id = false,
?bool  $equal_points = false,
bool  $could_be_offline = false,
bool  $show_path = false,
bool  $with_questioncount = false,
string  $permission = 'read' 
)

Returns the available question pools for the active user.

Returns
array The available question pools public

Definition at line 2636 of file class.ilObjTest.php.

References ilObjQuestionPool\_getAvailableQuestionpools().

2643  : array {
2645  $use_object_id,
2646  $equal_points ?? false,
2647  $could_be_offline,
2648  $show_path,
2649  $with_questioncount,
2650  $permission
2651  );
2652  }
static _getAvailableQuestionpools(bool $use_object_id=false, bool $equal_points=false, bool $could_be_offline=false, bool $showPath=false, bool $with_questioncount=false, string $permission='read', int $usr_id=0)
Returns the available question pools for the active user.
+ Here is the call graph for this function:

◆ getAvailableQuestions()

ilObjTest::getAvailableQuestions (   $arr_filter,
  $completeonly = 0 
)

Calculates the available questions for a test.

public

Definition at line 2814 of file class.ilObjTest.php.

References XapiProxy\$plugin, ilObjQuestionPool\_getAvailableQuestionpools(), ilAssQuestionType\completeMissingPluginName(), getExistingQuestions(), and ILIAS\Repository\lng().

2814  : array
2815  {
2816  $available_pools = array_keys(ilObjQuestionPool::_getAvailableQuestionpools(true, false, false, false, false));
2817  $available = "";
2818  if (count($available_pools)) {
2819  $available = " AND " . $this->db->in('qpl_questions.obj_fi', $available_pools, false, 'integer');
2820  } else {
2821  return [];
2822  }
2823  if ($completeonly) {
2824  $available .= " AND qpl_questions.complete = " . $this->db->quote("1", 'text');
2825  }
2826 
2827  $where = "";
2828  if (is_array($arr_filter)) {
2829  if (array_key_exists('title', $arr_filter) && strlen($arr_filter['title'])) {
2830  $where .= " AND " . $this->db->like('qpl_questions.title', 'text', "%%" . $arr_filter['title'] . "%%");
2831  }
2832  if (array_key_exists('description', $arr_filter) && strlen($arr_filter['description'])) {
2833  $where .= " AND " . $this->db->like('qpl_questions.description', 'text', "%%" . $arr_filter['description'] . "%%");
2834  }
2835  if (array_key_exists('author', $arr_filter) && strlen($arr_filter['author'])) {
2836  $where .= " AND " . $this->db->like('qpl_questions.author', 'text', "%%" . $arr_filter['author'] . "%%");
2837  }
2838  if (array_key_exists('type', $arr_filter) && strlen($arr_filter['type'])) {
2839  $where .= " AND qpl_qst_type.type_tag = " . $this->db->quote($arr_filter['type'], 'text');
2840  }
2841  if (array_key_exists('qpl', $arr_filter) && strlen($arr_filter['qpl'])) {
2842  $where .= " AND " . $this->db->like('object_data.title', 'text', "%%" . $arr_filter['qpl'] . "%%");
2843  }
2844  }
2845 
2846  $original_ids = &$this->getExistingQuestions();
2847  $original_clause = " qpl_questions.original_id IS NULL";
2848  if (count($original_ids)) {
2849  $original_clause = " qpl_questions.original_id IS NULL AND " . $this->db->in('qpl_questions.question_id', $original_ids, true, 'integer');
2850  }
2851 
2852  $query_result = $this->db->query("
2853  SELECT qpl_questions.*, qpl_questions.tstamp,
2854  qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name,
2855  object_data.title parent_title
2856  FROM qpl_questions, qpl_qst_type, object_data
2857  WHERE $original_clause $available
2858  AND object_data.obj_id = qpl_questions.obj_fi
2859  AND qpl_questions.tstamp > 0
2860  AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id
2861  $where
2862  ");
2863  $rows = [];
2864 
2865  if ($query_result->numRows()) {
2866  while ($row = $this->db->fetchAssoc($query_result)) {
2868 
2869  if (!$row['plugin']) {
2870  $row[ 'ttype' ] = $this->lng->txt($row[ "type_tag" ]);
2871 
2872  $rows[] = $row;
2873  continue;
2874  }
2875 
2876  $plugin = $this->component_repository->getPluginByName($row['plugin_name']);
2877  if (!$plugin->isActive()) {
2878  continue;
2879  }
2880 
2881  $pl = $this->component_factory->getPlugin($plugin->getId());
2882  $row[ 'ttype' ] = $pl->getQuestionTypeTranslation();
2883 
2884  $rows[] = $row;
2885  }
2886  }
2887  return $rows;
2888  }
static completeMissingPluginName(array $question_type_data)
& getExistingQuestions($pass=null)
Get the id&#39;s of the questions which are already part of the test.
static _getAvailableQuestionpools(bool $use_object_id=false, bool $equal_points=false, bool $could_be_offline=false, bool $showPath=false, bool $with_questioncount=false, string $permission='read', int $usr_id=0)
Returns the available question pools for the active user.
+ Here is the call graph for this function:

◆ getCompleteEvaluationData()

ilObjTest::getCompleteEvaluationData (   $filterby = '',
  $filtertext = '' 
)

Definition at line 2544 of file class.ilObjTest.php.

References $data, and getUnfilteredEvaluationData().

Referenced by getAggregatedResultsData(), and ILIAS\Test\Results\Data\Factory\retrieveResultData().

2545  {
2547  $data->setFilter($filterby, $filtertext);
2548  return $data;
2549  }
getUnfilteredEvaluationData()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCompleteManualFeedback()

ilObjTest::getCompleteManualFeedback ( int  $question_id)

Retrieves the manual feedback for a question in a test.

Parameters
integer$question_idQuestion ID
Returns
array The feedback text public

Definition at line 6123 of file class.ilObjTest.php.

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

6123  : array
6124  {
6125  global $DIC;
6126  $ilDB = $DIC['ilDB'];
6127 
6128  $feedback = [];
6129  $result = $ilDB->queryF(
6130  "SELECT * FROM tst_manual_fb WHERE question_fi = %s",
6131  ['integer'],
6132  [$question_id]
6133  );
6134 
6135  while ($row = $ilDB->fetchAssoc($result)) {
6136  $active = $row['active_fi'];
6137  $pass = $row['pass'];
6138  $question = $row['question_fi'];
6139 
6140  $row['feedback'] = ilRTE::_replaceMediaObjectImageSrc($row['feedback'] ?? '', 1);
6141 
6142  $feedback[$active][$pass][$question] = $row;
6143  }
6144 
6145  return $feedback;
6146  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getCompleteWorkingTime()

ilObjTest::getCompleteWorkingTime (   $user_id)

Returns the complete working time in seconds a user worked on the test.

Returns
integer The working time in seconds public

Definition at line 1990 of file class.ilObjTest.php.

References $user_id, and getTestId().

1990  : int
1991  {
1992  $result = $this->db->queryF(
1993  "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.user_fi = %s",
1994  ['integer','integer'],
1995  [$this->getTestId(), $user_id]
1996  );
1997  $time = 0;
1998  while ($row = $this->db->fetchAssoc($result)) {
1999  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
2000  $epoch_1 = mktime(
2001  (int) $matches[4],
2002  (int) $matches[5],
2003  (int) $matches[6],
2004  (int) $matches[2],
2005  (int) $matches[3],
2006  (int) $matches[1]
2007  );
2008  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
2009  $epoch_2 = mktime(
2010  (int) $matches[4],
2011  (int) $matches[5],
2012  (int) $matches[6],
2013  (int) $matches[2],
2014  (int) $matches[3],
2015  (int) $matches[1]
2016  );
2017  $time += ($epoch_2 - $epoch_1);
2018  }
2019  return $time;
2020  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getCompleteWorkingTimeOfParticipant()

ilObjTest::getCompleteWorkingTimeOfParticipant (   $active_id)

Returns the complete working time in seconds for a test participant.

Returns
integer The working time in seconds for the test participant public

Definition at line 2082 of file class.ilObjTest.php.

References getTestId().

2082  : int
2083  {
2084  $result = $this->db->queryF(
2085  "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.active_fi, tst_times.started",
2086  ['integer','integer'],
2087  [$this->getTestId(), $active_id]
2088  );
2089  $time = 0;
2090  while ($row = $this->db->fetchAssoc($result)) {
2091  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
2092  $epoch_1 = mktime(
2093  (int) $matches[4],
2094  (int) $matches[5],
2095  (int) $matches[6],
2096  (int) $matches[2],
2097  (int) $matches[3],
2098  (int) $matches[1]
2099  );
2100  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
2101  $epoch_2 = mktime(
2102  (int) $matches[4],
2103  (int) $matches[5],
2104  (int) $matches[6],
2105  (int) $matches[2],
2106  (int) $matches[3],
2107  (int) $matches[1]
2108  );
2109  $time += ($epoch_2 - $epoch_1);
2110  }
2111  return $time;
2112  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getCompleteWorkingTimeOfParticipants()

& ilObjTest::getCompleteWorkingTimeOfParticipants ( )

Returns the complete working time in seconds for all test participants.

Returns
array An array containing the working time in seconds for all test participants public

Definition at line 2028 of file class.ilObjTest.php.

References _getCompleteWorkingTimeOfParticipants(), and getTestId().

2028  : array
2029  {
2030  return $this->_getCompleteWorkingTimeOfParticipants($this->getTestId());
2031  }
getTestId()
Gets the database id of the additional test data.
& _getCompleteWorkingTimeOfParticipants($test_id)
Returns the complete working time in seconds for all test participants.
+ Here is the call graph for this function:

◆ getConcludingRemarksPageId()

ilObjTest::getConcludingRemarksPageId ( )

Definition at line 6762 of file class.ilObjTest.php.

References ilObject\getId(), getMainSettings(), getMainSettingsRepository(), and null.

6762  : int
6763  {
6764  $page_id = $this->getMainSettings()->getFinishingSettings()->getConcludingRemarksPageId();
6765  if ($page_id !== null) {
6766  return $page_id;
6767  }
6768 
6769  $page_object = new ilTestPage();
6770  $page_object->setParentId($this->getId());
6771  $new_page_id = $page_object->createPageWithNextId();
6772  $settings = $this->getMainSettings()->getFinishingSettings()
6773  ->withConcludingRemarksPageId($new_page_id);
6774  $this->getMainSettingsRepository()->store(
6775  $this->getMainSettings()->withFinishingSettings($settings)
6776  );
6777  return $new_page_id;
6778  }
ilSetting $settings
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
+ Here is the call graph for this function:

◆ getCountSystem()

ilObjTest::getCountSystem ( )

Definition at line 761 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

761  : int
762  {
763  return $this->getScoreSettings()->getScoringSettings()->getCountSystem();
764  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDetailedTestResults()

ilObjTest::getDetailedTestResults (   $participants)

returns all test results for all participants

Parameters
array$partipantsarray of user ids
Returns
array of fields, see code for column titles

Definition at line 6256 of file class.ilObjTest.php.

References $results, _getResultPass(), _instanciateQuestion(), getAnonymity(), and ILIAS\Repository\lng().

6256  : array
6257  {
6258  $results = [];
6259  if (count($participants)) {
6260  foreach ($participants as $active_id => $user_rec) {
6261  $row = [];
6262  $reached_points = 0;
6263  $max_points = 0;
6264  $pass = ilObjTest::_getResultPass($active_id);
6265  foreach ($this->questions as $value) {
6266  $question = ilObjTest::_instanciateQuestion($value);
6267  if (is_object($question)) {
6268  $max_points += $question->getMaximumPoints();
6269  $reached_points += $question->getReachedPoints($active_id, $pass);
6270  if ($max_points > 0) {
6271  $percentvalue = $reached_points / $max_points;
6272  if ($percentvalue < 0) {
6273  $percentvalue = 0.0;
6274  }
6275  } else {
6276  $percentvalue = 0;
6277  }
6278  if ($this->getAnonymity()) {
6279  $user_rec['firstname'] = "";
6280  $user_rec['lastname'] = $this->lng->txt("anonymous");
6281  }
6282  $results[] = [
6283  "user_id" => $user_rec['usr_id'],
6284  "matriculation" => $user_rec['matriculation'],
6285  "lastname" => $user_rec['lastname'],
6286  "firstname" => $user_rec['firstname'],
6287  "login" => $user_rec['login'],
6288  "question_id" => $question->getId(),
6289  "question_title" => $question->getTitle(),
6290  "reached_points" => $reached_points,
6291  "max_points" => $max_points,
6292  "passed" => $user_rec['passed'] ? '1' : '0',
6293  ];
6294  }
6295  }
6296  }
6297  }
6298  return $results;
6299  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
$results
+ Here is the call graph for this function:

◆ getEnableExamview()

ilObjTest::getEnableExamview ( )

Definition at line 6897 of file class.ilObjTest.php.

References getMainSettings().

6897  : bool
6898  {
6899  return $this->getMainSettings()->getFinishingSettings()->getShowAnswerOverview();
6900  }
+ Here is the call graph for this function:

◆ getEnableProcessingTime()

ilObjTest::getEnableProcessingTime ( )

Definition at line 940 of file class.ilObjTest.php.

References getMainSettings().

Referenced by isExecutable(), and isMaxProcessingTimeReached().

940  : bool
941  {
942  return $this->getMainSettings()->getTestBehaviourSettings()->getProcessingTimeEnabled();
943  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEndingTime()

ilObjTest::getEndingTime ( )

Definition at line 966 of file class.ilObjTest.php.

References getMainSettings(), and null.

Referenced by endingTimeReached(), isExecutable(), and toXML().

966  : int
967  {
968  $end_time = $this->getMainSettings()->getAccessSettings()->getEndTime();
969  return $end_time !== null ? $end_time->getTimestamp() : 0;
970  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExistingQuestions()

& ilObjTest::getExistingQuestions (   $pass = null)

Get the id's of the questions which are already part of the test.

Returns
array An array containing the already existing questions public

Definition at line 1524 of file class.ilObjTest.php.

References $data, getActiveIdOfUser(), getTestId(), isRandomTest(), null, and ILIAS\Repository\user().

Referenced by getAvailableQuestions().

1524  : array
1525  {
1526  $existing_questions = [];
1527  $active_id = $this->getActiveIdOfUser($this->user->getId());
1528  if ($this->isRandomTest()) {
1529  if (is_null($pass)) {
1530  $pass = 0;
1531  }
1532  $result = $this->db->queryF(
1533  "SELECT qpl_questions.original_id FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.pass = %s",
1534  ['integer','integer'],
1535  [$active_id, $pass]
1536  );
1537  } else {
1538  $result = $this->db->queryF(
1539  "SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id",
1540  ['integer'],
1541  [$this->getTestId()]
1542  );
1543  }
1544  while ($data = $this->db->fetchObject($result)) {
1545  if ($data->original_id === null) {
1546  continue;
1547  }
1548 
1549  array_push($existing_questions, $data->original_id);
1550  }
1551  return $existing_questions;
1552  }
getTestId()
Gets the database id of the additional test data.
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportDirectory()

ilObjTest::getExportDirectory ( )

Definition at line 365 of file class.ilObjTest.php.

References ilFileUtils\getDataDir(), ilObject\getId(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

365  : string
366  {
367  $export_dir = ilFileUtils::getDataDir() . "/tst_data" . "/tst_" . $this->getId() . "/export";
368  return $export_dir;
369  }
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ getExportSettings()

ilObjTest::getExportSettings ( )

Definition at line 6566 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6566  : int
6567  {
6568  return $this->getScoreSettings()->getResultDetailsSettings()->getExportSettings();
6569  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExtraTime()

ilObjTest::getExtraTime ( int  $active_id)
private

Definition at line 6956 of file class.ilObjTest.php.

References getTestId().

Referenced by getProcessingTimeInSeconds().

6956  : int
6957  {
6958  if ($active_id === 0) {
6959  return 0;
6960  }
6961  return $this->participant_repository
6962  ->getParticipantByActiveId($this->getTestId(), $active_id)
6963  ?->getExtraTime() ?? 0;
6964  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFinalStatement()

ilObjTest::getFinalStatement ( )

Definition at line 701 of file class.ilObjTest.php.

References getMainSettings(), and null.

Referenced by toXML().

701  : string
702  {
703  $page_id = $this->getMainSettings()->getFinishingSettings()->getConcludingRemarksPageId();
704  if ($page_id !== null) {
705  return (new ilTestPageGUI('tst', $page_id))->showPage();
706  }
707  return $this->getMainSettings()->getFinishingSettings()->getConcludingRemarksText();
708  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilTestPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestPageGUI: ilPublicUserProfile...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFixedParticipants()

ilObjTest::getFixedParticipants ( )

Definition at line 5574 of file class.ilObjTest.php.

References getMainSettings().

5574  : bool
5575  {
5576  return $this->getMainSettings()->getAccessSettings()->getFixedParticipants();
5577  }
+ Here is the call graph for this function:

◆ getFixedQuestionSetTotalPoints()

ilObjTest::getFixedQuestionSetTotalPoints ( )

Definition at line 5207 of file class.ilObjTest.php.

References getTestQuestions().

5207  : float
5208  {
5209  $points = 0;
5210 
5211  foreach ($this->getTestQuestions() as $question_data) {
5212  $points += $question_data['points'];
5213  }
5214 
5215  return $points;
5216  }
+ Here is the call graph for this function:

◆ getGeneralQuestionPropertiesRepository()

ilObjTest::getGeneralQuestionPropertiesRepository ( )

◆ getGenericAnswerFeedback()

ilObjTest::getGenericAnswerFeedback ( )

Definition at line 751 of file class.ilObjTest.php.

References getMainSettings().

751  : bool
752  {
753  return $this->getMainSettings()->getQuestionBehaviourSettings()->getInstantFeedbackGenericEnabled();
754  }
+ Here is the call graph for this function:

◆ getGlobalSettings()

ilObjTest::getGlobalSettings ( )

Definition at line 7303 of file class.ilObjTest.php.

Referenced by getTestParticipantsForManualScoring().

7304  {
7305  return $this->global_settings_repo->getGlobalSettings();
7306  }
+ Here is the caller graph for this function:

◆ getGroupData()

ilObjTest::getGroupData (   $ids)

Definition at line 4561 of file class.ilObjTest.php.

References ilObject\$ref_id, ilObject\_lookupDescription(), ilObject\_lookupObjId(), and ilObject\_lookupTitle().

4561  : array
4562  {
4563  if (!is_array($ids) || count($ids) == 0) {
4564  return [];
4565  }
4566  $result = [];
4567  foreach ($ids as $ref_id) {
4568  $obj_id = ilObject::_lookupObjId($ref_id);
4569  $result[$ref_id] = ["ref_id" => $ref_id, "title" => ilObject::_lookupTitle($obj_id), "description" => ilObject::_lookupDescription($obj_id)];
4570  }
4571  return $result;
4572  }
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
+ Here is the call graph for this function:

◆ getHighscoreAchievedTS()

ilObjTest::getHighscoreAchievedTS ( )

Returns if date and time of the scores achievement should be displayed.

Definition at line 6815 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6815  : bool
6816  {
6817  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreAchievedTS();
6818  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreAnon()

ilObjTest::getHighscoreAnon ( )

Gets if the highscores should be anonymized per setting.

Note: This method will retrieve the setting as set by the user. If you want to figure out, if the highscore is to be shown anonymized or not, with consideration of the global anon switch you should

See also
isHighscoreAnon().
Returns
bool True, if setting is to anonymize highscores.

Definition at line 6794 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by isHighscoreAnon(), and toXML().

6794  : bool
6795  {
6796  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreAnon();
6797  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreEnabled()

ilObjTest::getHighscoreEnabled ( )

Definition at line 6780 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6780  : bool
6781  {
6782  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreEnabled();
6783  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreHints()

ilObjTest::getHighscoreHints ( )

Gets, if the column with the number of requested hints should be shown.

Definition at line 6839 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6839  : bool
6840  {
6841  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreHints();
6842  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreMode()

ilObjTest::getHighscoreMode ( )

Definition at line 6877 of file class.ilObjTest.php.

References getScoreSettings().

6877  : int
6878  {
6879  return $this->getScoreSettings()->getGamificationSettings()->getHighScoreMode();
6880  }
+ Here is the call graph for this function:

◆ getHighscoreOwnTable()

ilObjTest::getHighscoreOwnTable ( )

Gets if the own rankings table should be shown.

Definition at line 6855 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6855  : bool
6856  {
6857  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreOwnTable();
6858  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscorePercentage()

ilObjTest::getHighscorePercentage ( )

Gets if the percentage column should be shown.

Definition at line 6831 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6831  : bool
6832  {
6833  return $this->getScoreSettings()->getGamificationSettings()->getHighscorePercentage();
6834  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreScore()

ilObjTest::getHighscoreScore ( )

Gets if the score column should be shown.

Definition at line 6823 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6823  : bool
6824  {
6825  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreScore();
6826  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreTopNum()

ilObjTest::getHighscoreTopNum ( int  $a_retval = 10)

Gets the number of entries which are to be shown in the top-rankings table.

Returns
integer Number of entries to be shown in the top-rankings table.

Definition at line 6872 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by ILIAS\Test\Results\Toplist\TestTopListRepository\getGeneralToplist(), ILIAS\Test\Results\Toplist\TestTopListRepository\getUserToplistByPercentage(), ILIAS\Test\Results\Toplist\TestTopListRepository\getUserToplistByWorkingtime(), and toXML().

6872  : int
6873  {
6874  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreTopNum();
6875  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreTopTable()

ilObjTest::getHighscoreTopTable ( )

Gets, if the top-rankings table should be shown.

Definition at line 6863 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6863  : bool
6864  {
6865  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreTopTable();
6866  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreWTime()

ilObjTest::getHighscoreWTime ( )

Gets if the column with the workingtime should be shown.

Definition at line 6847 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6847  : bool
6848  {
6849  return $this->getScoreSettings()->getGamificationSettings()->getHighscoreWTime();
6850  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

ilObjTest::getHtmlQuestionContentPurifier ( )
protected
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

Definition at line 7293 of file class.ilObjTest.php.

References ilHtmlPurifierFactory\getInstanceByType().

7294  {
7295  return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
7296  }
Interface for html sanitizing functionality.
static getInstanceByType(string $type)
+ Here is the call graph for this function:

◆ getImagePath()

ilObjTest::getImagePath ( )

Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_TEST/images.

public

Definition at line 2660 of file class.ilObjTest.php.

References CLIENT_WEB_DIR, and ilObject\getId().

2660  : string
2661  {
2662  return CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/images/";
2663  }
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the call graph for this function:

◆ getImagePathWeb()

ilObjTest::getImagePathWeb ( )

Returns the web image path for web accessable images of a test The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_TEST/images.

public

Definition at line 2671 of file class.ilObjTest.php.

References CLIENT_WEB_DIR, ilObject\getId(), and ilFileUtils\removeTrailingPathSeparators().

2672  {
2673  $webdir = ilFileUtils::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/" . $this->getId() . "/images/";
2674  return str_replace(
2675  ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH),
2677  $webdir
2678  );
2679  }
static removeTrailingPathSeparators(string $path)
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the call graph for this function:

◆ getImportMapping()

ilObjTest::getImportMapping ( )

get array of (two) new created questions for import id

Definition at line 3979 of file class.ilObjTest.php.

3979  : array
3980  {
3981  return [];
3982  }

◆ getInstantFeedbackSolution()

ilObjTest::getInstantFeedbackSolution ( )

Definition at line 756 of file class.ilObjTest.php.

References getMainSettings().

Referenced by toXML().

756  : bool
757  {
758  return $this->getMainSettings()->getQuestionBehaviourSettings()->getInstantFeedbackSolutionEnabled();
759  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIntroduction()

ilObjTest::getIntroduction ( )

Definition at line 682 of file class.ilObjTest.php.

References getMainSettings(), and null.

Referenced by toXML().

682  : string
683  {
684  $page_id = $this->getMainSettings()->getIntroductionSettings()->getIntroductionPageId();
685  if ($page_id !== null) {
686  return (new ilTestPageGUI('tst', $page_id))->showPage();
687  }
688 
689  return $this->getMainSettings()->getIntroductionSettings()->getIntroductionText();
690  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilTestPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestPageGUI: ilPublicUserProfile...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIntroductionPageId()

ilObjTest::getIntroductionPageId ( )

Definition at line 6744 of file class.ilObjTest.php.

References ilObject\getId(), getMainSettings(), getMainSettingsRepository(), and null.

6744  : int
6745  {
6746  $page_id = $this->getMainSettings()->getIntroductionSettings()->getIntroductionPageId();
6747  if ($page_id !== null) {
6748  return $page_id;
6749  }
6750 
6751  $page_object = new ilTestPage();
6752  $page_object->setParentId($this->getId());
6753  $new_page_id = $page_object->createPageWithNextId();
6754  $settings = $this->getMainSettings()->getIntroductionSettings()
6755  ->withIntroductionPageId($new_page_id);
6756  $this->getMainSettingsRepository()->store(
6757  $this->getMainSettings()->withIntroductionSettings($settings)
6758  );
6759  return $new_page_id;
6760  }
ilSetting $settings
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
+ Here is the call graph for this function:

◆ getInvitedUsers()

& ilObjTest::getInvitedUsers ( int  $user_id = 0,
  $order = "login, lastname, firstname" 
)

Returns a list of all invited users in a test.

Returns
array array of invited users public

Definition at line 4385 of file class.ilObjTest.php.

References $user_id, getAnonymity(), getTestId(), and ILIAS\Repository\lng().

4385  : array
4386  {
4387  $result_array = [];
4388 
4389  if ($this->getAnonymity()) {
4390  if ($user_id !== 0) {
4391  $result = $this->db->queryF(
4392  "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, " .
4393  "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
4394  "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
4395  "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
4396  "ORDER BY $order",
4397  ['text', 'text', 'text', 'integer', 'integer'],
4398  ['', $this->lng->txt('anonymous'), '', $this->getTestId(), $user_id]
4399  );
4400  } else {
4401  $result = $this->db->queryF(
4402  "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, " .
4403  "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
4404  "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
4405  "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
4406  "ORDER BY $order",
4407  ['text', 'text', 'text', 'integer'],
4408  ['', $this->lng->txt('anonymous'), '', $this->getTestId()]
4409  );
4410  }
4411  } else {
4412  if ($user_id !== 0) {
4413  $result = $this->db->queryF(
4414  "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, " .
4415  "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
4416  "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
4417  "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
4418  "ORDER BY $order",
4419  ['integer', 'integer'],
4420  [$this->getTestId(), $user_id]
4421  );
4422  } else {
4423  $result = $this->db->queryF(
4424  "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, " .
4425  "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
4426  "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
4427  "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
4428  "ORDER BY $order",
4429  ['integer'],
4430  [$this->getTestId()]
4431  );
4432  }
4433  }
4434  $result_array = [];
4435  while ($row = $this->db->fetchAssoc($result)) {
4436  $result_array[$row['usr_id']] = $row;
4437  }
4438  return $result_array;
4439  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getJavaScriptOutput()

ilObjTest::getJavaScriptOutput ( )

Returns if Javascript should be chosen for drag & drop actions for the active user.

Returns
boolean TRUE if Javascript should be chosen, FALSE otherwise public

Definition at line 6229 of file class.ilObjTest.php.

6229  : bool
6230  {
6231  return true;
6232  }

◆ getKioskMode()

ilObjTest::getKioskMode ( )

Definition at line 861 of file class.ilObjTest.php.

References getMainSettings().

861  : bool
862  {
863  return $this->getMainSettings()->getTestBehaviourSettings()->getKioskModeEnabled();
864  }
+ Here is the call graph for this function:

◆ getListOfQuestions()

ilObjTest::getListOfQuestions ( )

Definition at line 5272 of file class.ilObjTest.php.

References getMainSettings().

5272  : bool
5273  {
5274  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getQuestionListEnabled();
5275  }
+ Here is the call graph for this function:

◆ getListOfQuestionsDescription()

ilObjTest::getListOfQuestionsDescription ( )

Definition at line 5292 of file class.ilObjTest.php.

References getMainSettings().

5292  : bool
5293  {
5294  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getShowDescriptionInQuestionList();
5295  }
+ Here is the call graph for this function:

◆ getListOfQuestionsEnd()

ilObjTest::getListOfQuestionsEnd ( )

Definition at line 5287 of file class.ilObjTest.php.

References getMainSettings().

5287  : bool
5288  {
5289  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getShownQuestionListAtEnd();
5290  }
+ Here is the call graph for this function:

◆ getListOfQuestionsSettings()

ilObjTest::getListOfQuestionsSettings ( )

Returns the settings for the list of questions options in the test properties This could contain one of the following values: 0 = No list of questions offered 1 = A list of questions is offered 3 = A list of questions is offered and the list of questions is shown as first page of the test 5 = A list of questions is offered and the list of questions is shown as last page of the test 7 = A list of questions is offered and the list of questions is shown as first and last page of the test.

Returns
integer

Definition at line 5267 of file class.ilObjTest.php.

References getMainSettings().

5268  {
5269  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getUsrPassOverviewMode();
5270  }
+ Here is the call graph for this function:

◆ getListOfQuestionsStart()

ilObjTest::getListOfQuestionsStart ( )

Definition at line 5282 of file class.ilObjTest.php.

References getMainSettings().

5282  : bool
5283  {
5284  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getShownQuestionListAtBeginning();
5285  }
+ Here is the call graph for this function:

◆ getLocalDIC()

ilObjTest::getLocalDIC ( )

Definition at line 201 of file class.ilObjTest.php.

Referenced by ilTestServiceGUI\setContextResultPresentation().

201  : TestDIC
202  {
203  return TestDIC::dic();
204  }
+ Here is the caller graph for this function:

◆ getMailNotification()

ilObjTest::getMailNotification ( )

Definition at line 6485 of file class.ilObjTest.php.

References getMainSettings().

6485  : int
6486  {
6487  return $this->getMainSettings()->getFinishingSettings()->getMailNotificationContentType();
6488  }
+ Here is the call graph for this function:

◆ getMailNotificationType()

ilObjTest::getMailNotificationType ( )

Definition at line 6561 of file class.ilObjTest.php.

References getMainSettings().

6561  : bool
6562  {
6563  return $this->getMainSettings()->getFinishingSettings()->getAlwaysSendMailNotification();
6564  }
+ Here is the call graph for this function:

◆ getMainSettings()

ilObjTest::getMainSettings ( )

Definition at line 7308 of file class.ilObjTest.php.

References $main_settings, getMainSettingsRepository(), and getTestId().

Referenced by addDefaults(), applyDefaults(), cloneConcludingRemarks(), cloneIntroduction(), cloneObject(), fromXML(), getAnonymity(), getAnswerFeedbackPoints(), ILIAS\Test\Results\Presentation\Factory\getAttemptResultsSettings(), getAutosave(), getConcludingRemarksPageId(), getEnableExamview(), getEnableProcessingTime(), getEndingTime(), getFinalStatement(), getFixedParticipants(), getGenericAnswerFeedback(), getInstantFeedbackSolution(), getIntroduction(), getIntroductionPageId(), getKioskMode(), getListOfQuestions(), getListOfQuestionsDescription(), getListOfQuestionsEnd(), getListOfQuestionsSettings(), getListOfQuestionsStart(), getMailNotification(), getMailNotificationType(), getNrOfTries(), getPassword(), getProcessingTime(), getProcessingTimeForXML(), getProcessingTimeInSeconds(), getQuestionSetType(), getRedirectionMode(), getRedirectionUrl(), getResetProcessingTime(), getShowCancel(), getShowKioskModeParticipant(), getShowKioskModeTitle(), getShowMarker(), getShuffleQuestions(), getSpecificAnswerFeedback(), getStartingTime(), getTestParticipants(), getTitleOutput(), getUsePreviousAnswers(), getUsrPassOverviewEnabled(), isBlockPassesAfterPassedEnabled(), isEndingTimeEnabled(), isFollowupQuestionAnswerFixationEnabled(), isForceInstantFeedbackEnabled(), isInstantFeedbackAnswerFixationEnabled(), isNextPassAllowed(), isOfferingQuestionHintsEnabled(), isPasswordEnabled(), isPostponingEnabled(), isRedirectModeKiosk(), isRedirectModeNone(), isShowExamIdInTestPassEnabled(), isSkillServiceEnabled(), isSkillServiceToBeConsidered(), isStartingTimeEnabled(), setQuestionSetType(), and toXML().

7308  : MainSettings
7309  {
7310  if (!$this->main_settings) {
7311  $this->main_settings = $this->getMainSettingsRepository()
7312  ->getFor($this->getTestId());
7313  }
7314  return $this->main_settings;
7315  }
getTestId()
Gets the database id of the additional test data.
MainSettings $main_settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMainSettingsRepository()

ilObjTest::getMainSettingsRepository ( )

Definition at line 7317 of file class.ilObjTest.php.

References $main_settings_repo.

Referenced by applyDefaults(), cloneObject(), fromXML(), getConcludingRemarksPageId(), getIntroductionPageId(), and getMainSettings().

7318  {
7319  if (!$this->main_settings_repo) {
7320  $this->main_settings_repo = new MainSettingsDatabaseRepository($this->db);
7321  }
7323  }
MainSettingsRepository $main_settings_repo
+ Here is the caller graph for this function:

◆ getManualFeedback()

static ilObjTest::getManualFeedback ( int  $active_id,
int  $question_id,
?int  $pass 
)
static

Retrieves the feedback comment for a question in a test if it is finalized.

Parameters
integer$active_idActive ID of the user
integer$question_idQuestion ID
integer$passPass number
Returns
string The feedback text public

Definition at line 6077 of file class.ilObjTest.php.

References ilTestService\isManScoringDone(), and null.

Referenced by assQuestionGUI\getGenericFeedbackOutput(), and assClozeTestGUI\getGenericFeedbackOutput().

6077  : string
6078  {
6079  if ($pass === null) {
6080  return '';
6081  }
6082  $feedback = '';
6083  $row = self::getSingleManualFeedback((int) $active_id, (int) $question_id, (int) $pass);
6084 
6085  if ($row !== [] && ($row['finalized_evaluation'] || \ilTestService::isManScoringDone((int) $active_id))) {
6086  $feedback = $row['feedback'] ?? '';
6087  }
6088 
6089  return $feedback;
6090  }
static isManScoringDone(int $active_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMarkSchema()

ilObjTest::getMarkSchema ( )

Definition at line 836 of file class.ilObjTest.php.

References $mark_schema, getTestId(), and null.

Referenced by ILIAS\Test\Scoring\Marks\MarkSchemaGUI\__construct(), addDefaults(), applyDefaults(), cloneObject(), evalStatistical(), fromXML(), getAllTestResults(), getTotalPointsPassedArray(), isComplete(), saveToDb(), toXML(), and updateTestResultCache().

836  : MarkSchema
837  {
838  if ($this->mark_schema === null) {
839  $this->mark_schema = $this->marks_repository->getMarkSchemaFor($this->getTestId());
840  }
841 
842  return $this->mark_schema;
843  }
A class defining mark schemas for assessment test objects.
Definition: MarkSchema.php:35
getTestId()
Gets the database id of the additional test data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
MarkSchema $mark_schema
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxPassOfTest()

ilObjTest::getMaxPassOfTest ( )

Definition at line 6966 of file class.ilObjTest.php.

References $data, $res, and getTestId().

6966  : int
6967  {
6968  $query = '
6969  SELECT MAX(tst_pass_result.pass) + 1 max_res
6970  FROM tst_pass_result
6971  INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi
6972  WHERE test_fi = ' . $this->db->quote($this->getTestId(), 'integer') . '
6973  ';
6974  $res = $this->db->query($query);
6975  $data = $this->db->fetchAssoc($res);
6976  return (int) $data['max_res'];
6977  }
$res
Definition: ltiservices.php:66
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getNrOfResultsForPass()

ilObjTest::getNrOfResultsForPass (   $active_id,
  $pass 
)

Calculates the number of user results for a specific test pass.

Definition at line 597 of file class.ilObjTest.php.

597  : int
598  {
599  $result = $this->db->queryF(
600  "SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
601  ['integer','integer'],
602  [$active_id, $pass]
603  );
604  return $result->numRows();
605  }

◆ getNrOfTries()

ilObjTest::getNrOfTries ( )

Definition at line 851 of file class.ilObjTest.php.

References getMainSettings().

Referenced by hasNrOfTriesRestriction(), isExecutable(), isNrOfTriesReached(), and saveToDb().

851  : int
852  {
853  return $this->getMainSettings()->getTestBehaviourSettings()->getNumberOfTries();
854  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticipants()

ilObjTest::getParticipants ( )

Returns all persons who started the test.

Returns
array The active ids, names and logins of the persons who started the test

Definition at line 2289 of file class.ilObjTest.php.

References ANONYMOUS_USER_ID, getAnonymity(), getTestId(), and ILIAS\Repository\lng().

2289  : array
2290  {
2291  $result = $this->db->queryF(
2292  "SELECT tst_active.active_id, usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname ASC",
2293  ['integer'],
2294  [$this->getTestId()]
2295  );
2296  $persons_array = [];
2297  while ($row = $this->db->fetchAssoc($result)) {
2298  $name = $this->lng->txt("anonymous");
2299  $fullname = $this->lng->txt("anonymous");
2300  $login = "";
2301  if (!$this->getAnonymity()) {
2302  if (strlen($row["firstname"] . $row["lastname"] . $row["title"]) == 0) {
2303  $name = $this->lng->txt("deleted_user");
2304  $fullname = $this->lng->txt("deleted_user");
2305  $login = $this->lng->txt("unknown");
2306  } else {
2307  $login = $row["login"];
2308  if ($row["usr_id"] == ANONYMOUS_USER_ID) {
2309  $name = $this->lng->txt("anonymous");
2310  $fullname = $this->lng->txt("anonymous");
2311  } else {
2312  $name = trim($row["lastname"] . ", " . $row["firstname"] . " " . $row["title"]);
2313  $fullname = trim($row["title"] . " " . $row["firstname"] . " " . $row["lastname"]);
2314  }
2315  }
2316  }
2317  $persons_array[$row["active_id"]] = [
2318  "name" => $name,
2319  "fullname" => $fullname,
2320  "login" => $login
2321  ];
2322  }
2323  return $persons_array;
2324  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getParticipantsForTestAndQuestion()

ilObjTest::getParticipantsForTestAndQuestion (   $test_id,
  $question_id 
)

Creates an associated array with all active id's for a given test and original question id.

PhpAssignmentInConditionInspection

Definition at line 6366 of file class.ilObjTest.php.

References getAccessFilteredParticipantList().

6366  : array
6367  {
6368  $query = "
6369  SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass
6370  FROM tst_test_result
6371  INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s
6372  INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi
6373  LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
6374  WHERE tst_test_result.question_fi = %s
6375  ORDER BY usr_data.lastname ASC, usr_data.firstname ASC
6376  ";
6377 
6378  $result = $this->db->queryF(
6379  $query,
6380  ['integer', 'integer'],
6381  [$test_id, $question_id]
6382  );
6383  $foundusers = [];
6385  while ($row = $this->db->fetchAssoc($result)) {
6386  if ($this->getAccessFilteredParticipantList() && !$this->getAccessFilteredParticipantList()->isActiveIdInList($row["active_fi"])) {
6387  continue;
6388  }
6389 
6390  if (!array_key_exists($row["active_fi"], $foundusers)) {
6391  $foundusers[$row["active_fi"]] = [];
6392  }
6393  array_push($foundusers[$row["active_fi"]], ["pass" => $row["pass"], "qid" => $row["question_fi"]]);
6394  }
6395  return $foundusers;
6396  }
getAccessFilteredParticipantList()
+ Here is the call graph for this function:

◆ getPassed()

ilObjTest::getPassed (   $active_id)

Definition at line 6346 of file class.ilObjTest.php.

References _getResultPass(), and getTestResult().

6347  {
6348  $result = $this->db->queryF(
6349  "SELECT passed FROM tst_result_cache WHERE active_fi = %s",
6350  ['integer'],
6351  [$active_id]
6352  );
6353  if ($result->numRows()) {
6354  $row = $this->db->fetchAssoc($result);
6355  return $row['passed'];
6356  } else {
6357  $counted_pass = ilObjTest::_getResultPass($active_id);
6358  $result_array = &$this->getTestResult($active_id, $counted_pass);
6359  return $result_array["test"]["passed"];
6360  }
6361  }
getTestResult(int $active_id, ?int $pass=null, bool $ordered_sequence=false, bool $consider_hidden_questions=true, bool $consider_optional_questions=true)
Calculates the results of a test for a given user and returns an array with all test results...
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
+ Here is the call graph for this function:

◆ getPassScoring()

ilObjTest::getPassScoring ( )

Gets the pass scoring type.

Definition at line 793 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

793  : int
794  {
795  return $this->getScoreSettings()->getScoringSettings()->getPassScoring();
796  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPassword()

ilObjTest::getPassword ( )

Definition at line 997 of file class.ilObjTest.php.

References getMainSettings().

997  : ?string
998  {
999  return $this->getMainSettings()->getAccessSettings()->getPassword();
1000  }
+ Here is the call graph for this function:

◆ getPotentialRandomTestQuestions()

ilObjTest::getPotentialRandomTestQuestions ( )
Returns
array

Definition at line 5221 of file class.ilObjTest.php.

References getTestId().

5221  : array
5222  {
5223  $query = "
5224  SELECT questions.*,
5225  questtypes.type_tag,
5226  origquest.obj_fi orig_obj_fi
5227 
5228  FROM qpl_questions questions
5229 
5230  INNER JOIN qpl_qst_type questtypes
5231  ON questtypes.question_type_id = questions.question_type_fi
5232 
5233  INNER JOIN tst_rnd_cpy tstquest
5234  ON tstquest.qst_fi = questions.question_id
5235 
5236  LEFT JOIN qpl_questions origquest
5237  ON origquest.question_id = questions.original_id
5238 
5239  WHERE tstquest.tst_fi = %s
5240  ";
5241 
5242  $query_result = $this->db->queryF(
5243  $query,
5244  ['integer'],
5245  [$this->getTestId()]
5246  );
5247 
5248  return $this->db->fetchAll($query_result);
5249  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getProcessingTime()

ilObjTest::getProcessingTime ( )

Definition at line 906 of file class.ilObjTest.php.

References getMainSettings().

906  : ?string
907  {
908  return $this->getMainSettings()->getTestBehaviourSettings()->getProcessingTime();
909  }
+ Here is the call graph for this function:

◆ getProcessingTimeForXML()

ilObjTest::getProcessingTimeForXML ( )
private

Definition at line 911 of file class.ilObjTest.php.

References getMainSettings(), and null.

Referenced by toXML().

911  : string
912  {
913  $processing_time = $this->getMainSettings()->getTestBehaviourSettings()->getProcessingTime();
914  if ($processing_time === null
915  || $processing_time === ''
916  || !preg_match('/(\d{2}):(\d{2}):(\d{2})/is', $processing_time, $matches)
917  ) {
918  return '';
919  }
920 
921  return sprintf(
922  "P0Y0M0DT%dH%dM%dS",
923  $matches[1],
924  $matches[2],
925  $matches[3]
926  );
927  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProcessingTimeInSeconds()

ilObjTest::getProcessingTimeInSeconds ( int  $active_id = 0)

Definition at line 929 of file class.ilObjTest.php.

References getExtraTime(), and getMainSettings().

Referenced by isMaxProcessingTimeReached().

929  : int
930  {
931  $processing_time = $this->getMainSettings()->getTestBehaviourSettings()->getProcessingTime() ?? '';
932  if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", (string) $processing_time, $matches)) {
933  $extratime = $this->getExtraTime($active_id) * 60;
934  return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
935  } else {
936  return 0;
937  }
938  }
getExtraTime(int $active_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionCount()

ilObjTest::getQuestionCount ( )

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

References isRandomTest(), ILIAS\Repository\lng(), loadQuestions(), and ILIAS\Repository\logger().

Referenced by getQuestionCountWithoutReloading(), getQuestionsOfPass(), and getQuestionsOfTest().

4197  : int
4198  {
4199  $num = 0;
4200 
4201  if ($this->isRandomTest()) {
4202  $questionSetConfig = new ilTestRandomQuestionSetConfig(
4203  $this->tree,
4204  $this->db,
4205  $this->lng,
4206  $this->logger,
4207  $this->component_repository,
4208  $this,
4209  $this->questionrepository
4210  );
4211 
4212  $questionSetConfig->loadFromDb();
4213 
4214  if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
4215  $sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
4216  $this->db,
4217  $this,
4219  );
4220 
4221  $sourcePoolDefinitionList->loadDefinitions();
4222 
4223  if (is_int($sourcePoolDefinitionList->getQuestionAmount())) {
4224  $num = $sourcePoolDefinitionList->getQuestionAmount();
4225  }
4226  } elseif (is_int($questionSetConfig->getQuestionAmountPerTest())) {
4227  $num = $questionSetConfig->getQuestionAmountPerTest();
4228  }
4229  } else {
4230  $this->loadQuestions();
4231  $num = count($this->questions);
4232  }
4233 
4234  return $num;
4235  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionCountAndPointsForPassOfParticipant()

ilObjTest::getQuestionCountAndPointsForPassOfParticipant ( int  $active_id,
int  $pass 
)

Definition at line 2483 of file class.ilObjTest.php.

References $res, lookupQuestionSetTypeByActiveId(), QUESTION_SET_TYPE_FIXED, and QUESTION_SET_TYPE_RANDOM.

Referenced by updateTestPassResults().

2483  : array
2484  {
2485  $question_set_type = $this->lookupQuestionSetTypeByActiveId($active_id);
2486 
2487  switch ($question_set_type) {
2489  $res = $this->db->queryF(
2490  "
2491  SELECT tst_test_rnd_qst.pass,
2492  COUNT(tst_test_rnd_qst.question_fi) qcount,
2493  SUM(qpl_questions.points) qsum
2494 
2495  FROM tst_test_rnd_qst,
2496  qpl_questions
2497 
2498  WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id
2499  AND tst_test_rnd_qst.active_fi = %s
2500  AND pass = %s
2501 
2502  GROUP BY tst_test_rnd_qst.active_fi,
2503  tst_test_rnd_qst.pass
2504  ",
2505  ['integer', 'integer'],
2506  [$active_id, $pass]
2507  );
2508  break;
2509 
2511  $res = $this->db->queryF(
2512  "
2513  SELECT COUNT(tst_test_question.question_fi) qcount,
2514  SUM(qpl_questions.points) qsum
2515 
2516  FROM tst_test_question,
2517  qpl_questions,
2518  tst_active
2519 
2520  WHERE tst_test_question.question_fi = qpl_questions.question_id
2521  AND tst_test_question.test_fi = tst_active.test_fi
2522  AND tst_active.active_id = %s
2523 
2524  GROUP BY tst_test_question.test_fi
2525  ",
2526  ['integer'],
2527  [$active_id]
2528  );
2529  break;
2530 
2531  default:
2532  throw new ilTestException("not supported question set type: $question_set_type");
2533  }
2534 
2535  $row = $this->db->fetchAssoc($res);
2536 
2537  if (is_array($row)) {
2538  return ["count" => $row["qcount"], "points" => $row["qsum"]];
2539  }
2540 
2541  return ["count" => 0, "points" => 0];
2542  }
$res
Definition: ltiservices.php:66
const QUESTION_SET_TYPE_RANDOM
Base Exception for all Exceptions relating to Modules/Test.
lookupQuestionSetTypeByActiveId(int $active_id)
const QUESTION_SET_TYPE_FIXED
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionCountWithoutReloading()

ilObjTest::getQuestionCountWithoutReloading ( )

Definition at line 4237 of file class.ilObjTest.php.

References getQuestionCount(), and isRandomTest().

4237  : int
4238  {
4239  if ($this->isRandomTest()) {
4240  return $this->getQuestionCount();
4241  }
4242  return count($this->questions);
4243  }
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:

◆ getQuestionDataset()

ilObjTest::getQuestionDataset (   $question_id)

Returns the dataset for a given question id.

Parameters
integer$question_idThe database id of the question
Returns
object Question dataset public
See also
$questions

Definition at line 1507 of file class.ilObjTest.php.

Referenced by ilTestArchiver\handInParticipantUploadedResults().

1507  : object
1508  {
1509  $result = $this->db->queryF(
1510  "SELECT qpl_questions.*, qpl_qst_type.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",
1511  ['integer'],
1512  [$question_id]
1513  );
1514  $row = $this->db->fetchObject($result);
1515  return $row;
1516  }
+ Here is the caller graph for this function:

◆ getQuestions()

ilObjTest::getQuestions ( )

Definition at line 6679 of file class.ilObjTest.php.

References $questions.

6679  : array
6680  {
6681  return $this->questions;
6682  }
array $questions

◆ getQuestionSetConfig()

ilObjTest::getQuestionSetConfig ( )

Definition at line 216 of file class.ilObjTest.php.

Referenced by ILIAS\Test\Questions\Properties\DatabaseRepository\buildQuestionPropertiesForRandomTest().

217  {
218  return $this->question_set_config_factory->getQuestionSetConfig();
219  }
+ Here is the caller graph for this function:

◆ getQuestionSetType()

ilObjTest::getQuestionSetType ( )

Definition at line 7034 of file class.ilObjTest.php.

References getMainSettings().

Referenced by getQuestionTitles(), getQuestionTitlesAndIndexes(), isFixedTest(), isRandomTest(), and saveToDb().

7034  : string
7035  {
7036  return $this->getMainSettings()->getGeneralSettings()->getQuestionSetType();
7037  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionSetTypeTranslation()

ilObjTest::getQuestionSetTypeTranslation ( ilLanguage  $lng,
  $questionSetType 
)

Definition at line 7059 of file class.ilObjTest.php.

References QUESTION_SET_TYPE_FIXED, QUESTION_SET_TYPE_RANDOM, and ilLanguage\txt().

7059  : string
7060  {
7061  switch ($questionSetType) {
7063  return $lng->txt('tst_question_set_type_fixed');
7064 
7066  return $lng->txt('tst_question_set_type_random');
7067  }
7068 
7069  throw new ilTestException('invalid question set type value given: ' . $questionSetType);
7070  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const QUESTION_SET_TYPE_RANDOM
Base Exception for all Exceptions relating to Modules/Test.
const QUESTION_SET_TYPE_FIXED
+ Here is the call graph for this function:

◆ getQuestionsOfPass()

ilObjTest::getQuestionsOfPass ( int  $active_id,
int  $pass 
)

Definition at line 2423 of file class.ilObjTest.php.

References getQuestionCount(), and isRandomTest().

Referenced by ilTestArchiver\handInParticipantUploadedResults().

2423  : array
2424  {
2425  if ($this->isRandomTest()) {
2426  $this->db->setLimit($this->getQuestionCount(), 0);
2427  $result = $this->db->queryF(
2428  'SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, '
2429  . 'qpl_questions.points '
2430  . 'FROM tst_test_rnd_qst, qpl_questions '
2431  . 'WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id '
2432  . 'AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s '
2433  . 'ORDER BY tst_test_rnd_qst.sequence',
2434  ['integer', 'integer'],
2435  [$active_id, $pass]
2436  );
2437  } else {
2438  $result = $this->db->queryF(
2439  'SELECT tst_test_question.sequence, tst_test_question.question_fi, '
2440  . 'qpl_questions.points '
2441  . 'FROM tst_test_question, tst_active, qpl_questions '
2442  . 'WHERE tst_test_question.question_fi = qpl_questions.question_id '
2443  . 'AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi',
2444  ['integer'],
2445  [$active_id]
2446  );
2447  }
2448  $qpass = [];
2449  if ($result->numRows()) {
2450  while ($row = $this->db->fetchAssoc($result)) {
2451  array_push($qpass, $row);
2452  }
2453  }
2454  return $qpass;
2455  }
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionsOfTest()

ilObjTest::getQuestionsOfTest ( int  $active_id)

Definition at line 2390 of file class.ilObjTest.php.

References getQuestionCount(), and isRandomTest().

2390  : array
2391  {
2392  if ($this->isRandomTest()) {
2393  $this->db->setLimit($this->getQuestionCount(), 0);
2394  $result = $this->db->queryF(
2395  'SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, '
2396  . 'tst_test_rnd_qst.pass, qpl_questions.points '
2397  . 'FROM tst_test_rnd_qst, qpl_questions '
2398  . 'WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id '
2399  . 'AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence',
2400  ['integer'],
2401  [$active_id]
2402  );
2403  } else {
2404  $result = $this->db->queryF(
2405  'SELECT tst_test_question.sequence, tst_test_question.question_fi, '
2406  . 'qpl_questions.points '
2407  . 'FROM tst_test_question, tst_active, qpl_questions '
2408  . 'WHERE tst_test_question.question_fi = qpl_questions.question_id '
2409  . 'AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi',
2410  ['integer'],
2411  [$active_id]
2412  );
2413  }
2414  $qtest = [];
2415  if ($result->numRows()) {
2416  while ($row = $this->db->fetchAssoc($result)) {
2417  array_push($qtest, $row);
2418  }
2419  }
2420  return $qtest;
2421  }
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:

◆ getQuestiontext()

ilObjTest::getQuestiontext (   $question_id)

Returns the question text for a given question.

Parameters
integer$question_idThe question id
Returns
string The question text public

Definition at line 4354 of file class.ilObjTest.php.

References $res.

4354  : string
4355  {
4356  $res = "";
4357  if ($question_id) {
4358  $result = $this->db->queryF(
4359  "SELECT question_text FROM qpl_questions WHERE question_id = %s",
4360  ['integer'],
4361  [$question_id]
4362  );
4363  if ($result->numRows() == 1) {
4364  $row = $this->db->fetchAssoc($result);
4365  $res = $row["question_text"];
4366  }
4367  }
4368  return $res;
4369  }
$res
Definition: ltiservices.php:66

◆ getQuestionTitle()

ilObjTest::getQuestionTitle (   $title,
  $nr = null,
  $points = null 
)

Returns the title of a test question and checks if the title output is allowed.

If not, the localized text "question" will be returned.

Parameters
string$titleThe original title of the question
integer$nrThe number of the question in the sequence
Returns
string The title for the question title output public

Definition at line 1465 of file class.ilObjTest.php.

References ilObject\$title, $txt, getTitleOutput(), and ILIAS\Repository\lng().

1465  : string
1466  {
1467  switch ($this->getTitleOutput()) {
1468  case '0':
1469  case '1':
1470  return $title;
1471  break;
1472  case '2':
1473  if (isset($nr)) {
1474  return $this->lng->txt("ass_question") . ' ' . $nr;
1475  }
1476  return $this->lng->txt("ass_question");
1477  break;
1478  case 3:
1479  if (isset($nr)) {
1480  $txt = $this->lng->txt("ass_question") . ' ' . $nr;
1481  } else {
1482  $txt = $this->lng->txt("ass_question");
1483  }
1484  if ($points != '') {
1485  $lngv = $this->lng->txt('points');
1486  if ($points == 1) {
1487  $lngv = $this->lng->txt('point');
1488  }
1489  $txt .= ' - ' . $points . ' ' . $lngv;
1490  }
1491  return $txt;
1492  break;
1493 
1494  }
1495  return $this->lng->txt("ass_question");
1496  }
string $title
$txt
Definition: error.php:31
+ Here is the call graph for this function:

◆ getQuestionTitles()

ilObjTest::getQuestionTitles ( )
private

Definition at line 1411 of file class.ilObjTest.php.

References getQuestionSetType(), and getTestId().

Referenced by copyQuestions().

1411  : array
1412  {
1413  $titles = [];
1414  if ($this->getQuestionSetType() === self::QUESTION_SET_TYPE_FIXED) {
1415  $result = $this->db->queryF(
1416  'SELECT qpl_questions.title FROM tst_test_question, qpl_questions '
1417  . 'WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id '
1418  . 'ORDER BY tst_test_question.sequence',
1419  ['integer'],
1420  [$this->getTestId()]
1421  );
1422  while ($row = $this->db->fetchAssoc($result)) {
1423  array_push($titles, $row['title']);
1424  }
1425  }
1426  return $titles;
1427  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionTitlesAndIndexes()

ilObjTest::getQuestionTitlesAndIndexes ( )

Returns the titles of the test questions in question sequence.

Returns
array The question titles public
See also
$questions

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

References getQuestionSetType(), and getTestId().

Referenced by hasQuestionsWithoutQuestionpool().

1436  : array
1437  {
1438  $titles = [];
1439  if ($this->getQuestionSetType() == self::QUESTION_SET_TYPE_FIXED) {
1440  $result = $this->db->queryF(
1441  'SELECT qpl_questions.title, qpl_questions.question_id '
1442  . 'FROM tst_test_question, qpl_questions '
1443  . 'WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id '
1444  . 'ORDER BY tst_test_question.sequence',
1445  ['integer'],
1446  [$this->getTestId()]
1447  );
1448  while ($row = $this->db->fetchAssoc($result)) {
1449  $titles[$row['question_id']] = $row["title"];
1450  }
1451  }
1452  return $titles;
1453  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionType()

ilObjTest::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 1561 of file class.ilObjTest.php.

References $data.

Referenced by createQuestionGUI().

1562  {
1563  if ($question_id < 1) {
1564  return -1;
1565  }
1566  $result = $this->db->queryF(
1567  "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",
1568  ['integer'],
1569  [$question_id]
1570  );
1571  if ($result->numRows() == 1) {
1572  $data = $this->db->fetchObject($result);
1573  return $data->type_tag;
1574  } else {
1575  return "";
1576  }
1577  }
+ Here is the caller graph for this function:

◆ getRedirectionMode()

ilObjTest::getRedirectionMode ( )

Definition at line 972 of file class.ilObjTest.php.

References getMainSettings().

972  : int
973  {
974  return $this->getMainSettings()->getFinishingSettings()->getRedirectionMode();
975  }
+ Here is the call graph for this function:

◆ getRedirectionUrl()

ilObjTest::getRedirectionUrl ( )

Definition at line 987 of file class.ilObjTest.php.

References getMainSettings().

987  : string
988  {
989  return $this->getMainSettings()->getFinishingSettings()->getRedirectionUrl() ?? '';
990  }
+ Here is the call graph for this function:

◆ getResetProcessingTime()

ilObjTest::getResetProcessingTime ( )

Definition at line 945 of file class.ilObjTest.php.

References getMainSettings().

Referenced by getStartingTimeOfUser().

945  : bool
946  {
947  return $this->getMainSettings()->getTestBehaviourSettings()->getResetProcessingTime();
948  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultsForActiveId()

ilObjTest::getResultsForActiveId ( int  $active_id)

Definition at line 6526 of file class.ilObjTest.php.

References updateTestResultCache().

Referenced by ilTestArchiver\getResultsOfUserOutput(), and getTestResult().

6526  : array
6527  {
6528  $query = "
6529  SELECT *
6530  FROM tst_result_cache
6531  WHERE active_fi = %s
6532  ";
6533 
6534  $result = $this->db->queryF(
6535  $query,
6536  ['integer'],
6537  [$active_id]
6538  );
6539 
6540  if (!$result->numRows()) {
6541  $this->updateTestResultCache($active_id);
6542 
6543  $query = "
6544  SELECT *
6545  FROM tst_result_cache
6546  WHERE active_fi = %s
6547  ";
6548 
6549  $result = $this->db->queryF(
6550  $query,
6551  ['integer'],
6552  [$active_id]
6553  );
6554  }
6555 
6556  $row = $this->db->fetchAssoc($result);
6557 
6558  return $row;
6559  }
updateTestResultCache(int $active_id, ?ilAssQuestionProcessLocker $process_locker=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleData()

ilObjTest::getRoleData (   $ids)

Definition at line 4574 of file class.ilObjTest.php.

References ilObject\_lookupDescription(), and ilObject\_lookupTitle().

4574  : array
4575  {
4576  if (!is_array($ids) || count($ids) == 0) {
4577  return [];
4578  }
4579  $result = [];
4580  foreach ($ids as $obj_id) {
4581  $result[$obj_id] = ["obj_id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "description" => ilObject::_lookupDescription($obj_id)];
4582  }
4583  return $result;
4584  }
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
+ Here is the call graph for this function:

◆ getScoreCutting()

ilObjTest::getScoreCutting ( )

Determines if the score of a question should be cut at 0 points or the score of the whole test.

Definition at line 785 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by getTestResult(), and toXML().

785  : int
786  {
787  return $this->getScoreSettings()->getScoringSettings()->getScoreCutting();
788  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoreSettings()

ilObjTest::getScoreSettings ( )

Definition at line 7325 of file class.ilObjTest.php.

References $score_settings, getScoreSettingsRepository(), and getTestId().

Referenced by addDefaults(), applyDefaults(), cloneObject(), fromXML(), ILIAS\Test\Results\Presentation\Factory\getAttemptResultsSettings(), getCountSystem(), getExportSettings(), getHighscoreAchievedTS(), getHighscoreAnon(), getHighscoreEnabled(), getHighscoreHints(), getHighscoreMode(), getHighscoreOwnTable(), getHighscorePercentage(), getHighscoreScore(), getHighscoreTopNum(), getHighscoreTopTable(), getHighscoreWTime(), getPassScoring(), getScoreCutting(), getShowPassDetails(), getShowSolutionAnswersOnly(), getShowSolutionFeedback(), getShowSolutionListComparison(), getShowSolutionListOwnAnswers(), getShowSolutionPrintview(), getShowSolutionSignature(), getShowSolutionSuggested(), isPassDeletionAllowed(), isScoreReportingEnabled(), isShowExamIdInTestResultsEnabled(), isShowGradingMarkEnabled(), isShowGradingStatusEnabled(), marksEditable(), and toXML().

7325  : ScoreSettings
7326  {
7327  if (!$this->score_settings) {
7328  $this->score_settings = $this->getScoreSettingsRepository()
7329  ->getFor($this->getTestId());
7330  }
7331  return $this->score_settings;
7332  }
getTestId()
Gets the database id of the additional test data.
ScoreSettings $score_settings
getScoreSettingsRepository()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoreSettingsRepository()

ilObjTest::getScoreSettingsRepository ( )

Definition at line 7334 of file class.ilObjTest.php.

References $score_settings_repo.

Referenced by applyDefaults(), cloneObject(), fromXML(), and getScoreSettings().

7335  {
7336  if (!$this->score_settings_repo) {
7337  $this->score_settings_repo = new ScoreSettingsDatabaseRepository($this->db);
7338  }
7340  }
ScoreSettingsRepository $score_settings_repo
+ Here is the caller graph for this function:

◆ getShowCancel()

ilObjTest::getShowCancel ( )

Definition at line 5564 of file class.ilObjTest.php.

References getMainSettings().

5564  : bool
5565  {
5566  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getSuspendTestAllowed();
5567  }
+ Here is the call graph for this function:

◆ getShowKioskModeParticipant()

ilObjTest::getShowKioskModeParticipant ( )

Definition at line 870 of file class.ilObjTest.php.

References getMainSettings().

870  : bool
871  {
872  return $this->getMainSettings()->getTestBehaviourSettings()->getShowParticipantNameInKioskMode();
873  }
+ Here is the call graph for this function:

◆ getShowKioskModeTitle()

ilObjTest::getShowKioskModeTitle ( )

Definition at line 866 of file class.ilObjTest.php.

References getMainSettings().

866  : bool
867  {
868  return $this->getMainSettings()->getTestBehaviourSettings()->getShowTitleInKioskMode();
869  }
+ Here is the call graph for this function:

◆ getShowMarker()

ilObjTest::getShowMarker ( )

Definition at line 5569 of file class.ilObjTest.php.

References getMainSettings().

5569  : bool
5570  {
5571  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getQuestionMarkingEnabled();
5572  }
+ Here is the call graph for this function:

◆ getShowPassDetails()

ilObjTest::getShowPassDetails ( )

Returns if the pass details should be shown when a test is not finished.

Definition at line 5300 of file class.ilObjTest.php.

References getScoreSettings().

5300  : bool
5301  {
5302  return $this->getScoreSettings()->getResultDetailsSettings()->getShowPassDetails();
5303  }
+ Here is the call graph for this function:

◆ getShowSolutionAnswersOnly()

ilObjTest::getShowSolutionAnswersOnly ( )

Returns if the full solution (including ILIAS content) should be presented to the solution or not.

Definition at line 5331 of file class.ilObjTest.php.

References getScoreSettings().

5331  : bool
5332  {
5333  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionAnswersOnly();
5334  }
+ Here is the call graph for this function:

◆ getShowSolutionFeedback()

ilObjTest::getShowSolutionFeedback ( )

Returns if the feedback should be presented to the solution or not.

Definition at line 5323 of file class.ilObjTest.php.

References getScoreSettings().

5323  : bool
5324  {
5325  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionFeedback();
5326  }
+ Here is the call graph for this function:

◆ getShowSolutionListComparison()

ilObjTest::getShowSolutionListComparison ( )
Returns
boolean TRUE if the results should be compared with the correct results in the list of answers, FALSE otherwise public

Definition at line 5356 of file class.ilObjTest.php.

References getScoreSettings().

5356  : bool
5357  {
5358  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionListComparison();
5359  }
+ Here is the call graph for this function:

◆ getShowSolutionListOwnAnswers()

ilObjTest::getShowSolutionListOwnAnswers ( )

Definition at line 5361 of file class.ilObjTest.php.

References getScoreSettings().

5361  : bool
5362  {
5363  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionListOwnAnswers();
5364  }
+ Here is the call graph for this function:

◆ getShowSolutionPrintview()

ilObjTest::getShowSolutionPrintview ( )

Returns if the solution printview should be presented to the user or not.

Definition at line 5308 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by canShowSolutionPrintview().

5308  : bool
5309  {
5310  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionPrintview();
5311  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowSolutionSignature()

ilObjTest::getShowSolutionSignature ( )

Returns if the signature field should be shown in the test results.

Definition at line 5339 of file class.ilObjTest.php.

References getScoreSettings().

5339  : bool
5340  {
5341  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionSignature();
5342  }
+ Here is the call graph for this function:

◆ getShowSolutionSuggested()

ilObjTest::getShowSolutionSuggested ( )
Returns
boolean TRUE if the suggested solutions should be shown, FALSE otherwise

Definition at line 5347 of file class.ilObjTest.php.

References getScoreSettings().

5347  : bool
5348  {
5349  return $this->getScoreSettings()->getResultDetailsSettings()->getShowSolutionSuggested();
5350  }
+ Here is the call graph for this function:

◆ getShuffleQuestions()

ilObjTest::getShuffleQuestions ( )

Definition at line 5251 of file class.ilObjTest.php.

References getMainSettings().

Referenced by adjustTestSequence().

5251  : bool
5252  {
5253  return $this->getMainSettings()->getQuestionBehaviourSettings()->getShuffleQuestions();
5254  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSingleManualFeedback()

static ilObjTest::getSingleManualFeedback ( int  $active_id,
int  $question_id,
int  $pass 
)
static

Definition at line 6092 of file class.ilObjTest.php.

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

Referenced by ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\buildForm(), ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\buildManScoringParticipantForm(), and ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\saveManScoringByQuestion().

6092  : array
6093  {
6094  global $DIC;
6095  $ilDB = $DIC['ilDB'];
6096  $row = [];
6097  $result = $ilDB->queryF(
6098  "SELECT * FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
6099  ['integer', 'integer', 'integer'],
6100  [$active_id, $question_id, $pass]
6101  );
6102 
6103  if ($ilDB->numRows($result) === 1) {
6104  $row = $ilDB->fetchAssoc($result);
6105  $row['feedback'] = ilRTE::_replaceMediaObjectImageSrc($row['feedback'] ?? '', 1);
6106  } elseif ($ilDB->numRows($result) > 1) {
6107  $DIC->logger()->root()->warning(
6108  "WARNING: Multiple feedback entries on tst_manual_fb for " .
6109  "active_fi = $active_id , question_fi = $question_id and pass = $pass"
6110  );
6111  }
6112 
6113  return $row;
6114  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedback()

ilObjTest::getSpecificAnswerFeedback ( )

Definition at line 6882 of file class.ilObjTest.php.

References getMainSettings().

6882  : bool
6883  {
6884  return $this->getMainSettings()->getQuestionBehaviourSettings()->getInstantFeedbackSpecificEnabled();
6885  }
+ Here is the call graph for this function:

◆ getStartingTime()

ilObjTest::getStartingTime ( )

Definition at line 955 of file class.ilObjTest.php.

References getMainSettings(), and null.

Referenced by isExecutable(), startingTimeReached(), and toXML().

955  : int
956  {
957  $start_time = $this->getMainSettings()->getAccessSettings()->getStartTime();
958  return $start_time !== null ? $start_time->getTimestamp() : 0;
959  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartingTimeOfParticipants()

ilObjTest::getStartingTimeOfParticipants ( )

Note, this function should only be used if absolutely necessary, since it perform joins on tables that tend to grow huge and returns vast amount of data.

If possible, use getStartingTimeOfUser($active_id) instead

Returns
array

Definition at line 6928 of file class.ilObjTest.php.

References getTestId().

6928  : array
6929  {
6930  $times = [];
6931  $result = $this->db->queryF(
6932  "SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s ORDER BY tst_times.tstamp DESC",
6933  ['integer'],
6934  [$this->getTestId()]
6935  );
6936  while ($row = $this->db->fetchAssoc($result)) {
6937  $times[$row['active_fi']] = $row['started'];
6938  }
6939  return $times;
6940  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getStartingTimeOfUser()

ilObjTest::getStartingTimeOfUser (   $active_id,
  $pass = null 
)

Returns the unix timestamp of the time a user started a test.

Parameters
integer$active_idThe active id of the user
Returns
false|int The unix timestamp if the user started the test, FALSE otherwise public

Definition at line 5085 of file class.ilObjTest.php.

References getResetProcessingTime(), and null.

Referenced by isExecutable().

5086  {
5087  if ($active_id < 1) {
5088  return false;
5089  }
5090  if ($pass === null) {
5091  $pass = ($this->getResetProcessingTime()) ? self::_getPass($active_id) : 0;
5092  }
5093  $result = $this->db->queryF(
5094  "SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
5095  ['integer', 'integer'],
5096  [$active_id, $pass]
5097  );
5098  if ($result->numRows()) {
5099  $row = $this->db->fetchAssoc($result);
5100  if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches)) {
5101  return mktime(
5102  (int) $matches[4],
5103  (int) $matches[5],
5104  (int) $matches[6],
5105  (int) $matches[2],
5106  (int) $matches[3],
5107  (int) $matches[1]
5108  );
5109  } else {
5110  return time();
5111  }
5112  } else {
5113  return time();
5114  }
5115  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplate()

ilObjTest::getTemplate ( )

Definition at line 6576 of file class.ilObjTest.php.

References $template_id.

Referenced by cloneObject(), and saveToDb().

6576  : int
6577  {
6578  return $this->template_id;
6579  }
+ Here is the caller graph for this function:

◆ getTestDefaults()

ilObjTest::getTestDefaults (   $test_defaults_id)

Definition at line 5644 of file class.ilObjTest.php.

References null.

5644  : ?array
5645  {
5646  $result = $this->db->queryF(
5647  "SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
5648  ['integer'],
5649  [$test_defaults_id]
5650  );
5651  if ($result->numRows() == 1) {
5652  $row = $this->db->fetchAssoc($result);
5653  return $row;
5654  } else {
5655  return null;
5656  }
5657  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getTestId()

◆ getTestLogger()

ilObjTest::getTestLogger ( )

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

References $logger.

206  : TestLogger
207  {
208  return $this->logger;
209  }
TestLogger $logger

◆ getTestLogViewer()

ilObjTest::getTestLogViewer ( )

Definition at line 211 of file class.ilObjTest.php.

References $log_viewer.

211  : TestLogViewer
212  {
213  return $this->log_viewer;
214  }
TestLogViewer $log_viewer

◆ getTestObjIdsWithActiveForUserId()

static ilObjTest::getTestObjIdsWithActiveForUserId (   $userId)
static

Definition at line 7089 of file class.ilObjTest.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

7089  : array
7090  {
7091  global $DIC;
7092  $ilDB = $DIC['ilDB'];
7093 
7094  $query = "
7095  SELECT obj_fi
7096  FROM tst_active
7097  INNER JOIN tst_tests
7098  ON test_id = test_fi
7099  WHERE user_fi = %s
7100  ";
7101 
7102  $res = $ilDB->queryF($query, ['integer'], [$userId]);
7103 
7104  $objIds = [];
7105 
7106  while ($row = $ilDB->fetchAssoc($res)) {
7107  $objIds[] = (int) $row['obj_fi'];
7108  }
7109 
7110  return $objIds;
7111  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getTestParticipants()

ilObjTest::getTestParticipants ( )

Definition at line 4441 of file class.ilObjTest.php.

References $data, getAnonymity(), getGeneralSettings(), getMainSettings(), getTestId(), and ILIAS\Repository\lng().

Referenced by buildStatisticsAccessFilteredParticipantList(), getActiveParticipantList(), and getTestParticipantsForManualScoring().

4441  : array
4442  {
4443  if ($this->getMainSettings()->getGeneralSettings()->getAnonymity()) {
4444  $query = "
4445  SELECT tst_active.active_id,
4446  tst_active.tries,
4447  tst_active.user_fi usr_id,
4448  %s login,
4449  %s lastname,
4450  %s firstname,
4451  tst_active.submitted test_finished,
4452  usr_data.matriculation,
4453  usr_data.active,
4454  tst_active.lastindex,
4455  COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes
4456  FROM tst_active
4457  LEFT JOIN usr_data
4458  ON tst_active.user_fi = usr_data.usr_id
4459  WHERE tst_active.test_fi = %s
4460  ORDER BY usr_data.lastname
4461  ";
4462  $result = $this->db->queryF(
4463  $query,
4464  ['text', 'text', 'text', 'integer'],
4465  ['', $this->lng->txt("anonymous"), "", $this->getTestId()]
4466  );
4467  } else {
4468  $query = "
4469  SELECT tst_active.active_id,
4470  tst_active.tries,
4471  tst_active.user_fi usr_id,
4472  usr_data.login,
4473  usr_data.lastname,
4474  usr_data.firstname,
4475  tst_active.submitted test_finished,
4476  usr_data.matriculation,
4477  usr_data.active,
4478  tst_active.lastindex,
4479  COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes
4480  FROM tst_active
4481  LEFT JOIN usr_data
4482  ON tst_active.user_fi = usr_data.usr_id
4483  WHERE tst_active.test_fi = %s
4484  ORDER BY usr_data.lastname
4485  ";
4486  $result = $this->db->queryF(
4487  $query,
4488  ['integer'],
4489  [$this->getTestId()]
4490  );
4491  }
4492  $data = [];
4493  while ($row = $this->db->fetchAssoc($result)) {
4494  $data[$row['active_id']] = $row;
4495  }
4496  foreach ($data as $index => $participant) {
4497  if (strlen(trim($participant["firstname"] . $participant["lastname"])) == 0) {
4498  $data[$index]["lastname"] = $this->lng->txt("deleted_user");
4499  }
4500  }
4501  return $data;
4502  }
getTestId()
Gets the database id of the additional test data.
getGeneralSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestParticipantsForManualScoring()

ilObjTest::getTestParticipantsForManualScoring (   $filter = null)

Definition at line 4504 of file class.ilObjTest.php.

References getGlobalSettings(), and getTestParticipants().

4504  : array
4505  {
4506  if (!$this->getGlobalSettings()->isManualScoringEnabled()) {
4507  return [];
4508  }
4509 
4510  $filtered_participants = [];
4511  foreach ($this->getTestParticipants() as $active_id => $participant) {
4512  if ($participant['tries'] > 0) {
4513  switch ($filter) {
4514  case 4:
4515  if ($this->test_man_scoring_done_helper->isDone((int) $active_id)) {
4516  $filtered_participants[$active_id] = $participant;
4517  }
4518  break;
4519  case 5:
4520  if (!$this->test_man_scoring_done_helper->isDone((int) $active_id)) {
4521  $filtered_participants[$active_id] = $participant;
4522  }
4523  break;
4524  default:
4525  $filtered_participants[$active_id] = $participant;
4526  }
4527  }
4528  }
4529  return $filtered_participants;
4530  }
+ Here is the call graph for this function:

◆ getTestQuestions()

ilObjTest::getTestQuestions ( )

Definition at line 5138 of file class.ilObjTest.php.

References $questions, getTestId(), null, and ILIAS\Repository\refinery().

Referenced by getFixedQuestionSetTotalPoints(), ILIAS\Test\Questions\Presentation\QuestionsTableQuery\getRowIds(), isTestQuestion(), and removeQuestionWithResults().

5138  : array
5139  {
5140  $tags_trafo = $this->refinery->string()->stripTags();
5141 
5142  $query = "
5143  SELECT questions.*,
5144  questtypes.type_tag,
5145  tstquest.sequence,
5146  origquest.obj_fi orig_obj_fi
5147 
5148  FROM qpl_questions questions
5149 
5150  INNER JOIN qpl_qst_type questtypes
5151  ON questtypes.question_type_id = questions.question_type_fi
5152 
5153  INNER JOIN tst_test_question tstquest
5154  ON tstquest.question_fi = questions.question_id
5155 
5156  LEFT JOIN qpl_questions origquest
5157  ON origquest.question_id = questions.original_id
5158 
5159  WHERE tstquest.test_fi = %s
5160 
5161  ORDER BY tstquest.sequence
5162  ";
5163 
5164  $query_result = $this->db->queryF(
5165  $query,
5166  ['integer'],
5167  [$this->getTestId()]
5168  );
5169 
5170  $questions = [];
5171 
5172  while ($row = $this->db->fetchAssoc($query_result)) {
5173  $row['title'] = $tags_trafo->transform($row['title']);
5174  $row['description'] = $tags_trafo->transform($row['description'] !== '' && $row['description'] !== null ? $row['description'] : '&nbsp;');
5175  $row['author'] = $tags_trafo->transform($row['author']);
5176 
5177  $questions[] = $row;
5178  }
5179 
5180  return $questions;
5181  }
getTestId()
Gets the database id of the additional test data.
array $questions
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestResult()

ilObjTest::getTestResult ( int  $active_id,
?int  $pass = null,
bool  $ordered_sequence = false,
bool  $consider_hidden_questions = true,
bool  $consider_optional_questions = true 
)

Calculates the results of a test for a given user and returns an array with all test results.

Returns
array An array containing the test results for the given user

Definition at line 1788 of file class.ilObjTest.php.

References $data, $results, $test_sequence, assQuestion\_getSuggestedSolutionOutput(), getResultsForActiveId(), getScoreCutting(), ILIAS\Repository\int(), null, and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by ILIAS\Test\Results\Data\Factory\buildAttemptResults(), evalStatistical(), getPassed(), ilTestArchiver\getResultsOfUserOutput(), and getTotalPointsPassedArray().

1794  : array {
1795  $results = $this->getResultsForActiveId($active_id);
1796 
1797  if ($pass === null) {
1798  $pass = (int) $results['pass'];
1799  }
1800 
1801  $test_sequence_factory = new ilTestSequenceFactory($this, $this->db, $this->questionrepository);
1802  $test_sequence = $test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
1803 
1804  $test_sequence->setConsiderHiddenQuestionsEnabled($consider_hidden_questions);
1805  $test_sequence->setConsiderOptionalQuestionsEnabled($consider_optional_questions);
1806 
1807  $test_sequence->loadFromDb();
1808  $test_sequence->loadQuestions();
1809 
1810  if ($ordered_sequence) {
1811  $sequence = $test_sequence->getOrderedSequenceQuestions();
1812  } else {
1813  $sequence = $test_sequence->getUserSequenceQuestions();
1814  }
1815 
1816  $arr_results = [];
1817 
1818  $query = "
1819  SELECT
1820  tst_test_result.question_fi,
1821  tst_test_result.points reached,
1822  tst_test_result.hint_count requested_hints,
1823  tst_test_result.hint_points hint_points,
1824  tst_test_result.answered answered,
1825  tst_manual_fb.finalized_evaluation finalized_evaluation
1826 
1827  FROM tst_test_result
1828 
1829  LEFT JOIN tst_solutions
1830  ON tst_solutions.active_fi = tst_test_result.active_fi
1831  AND tst_solutions.question_fi = tst_test_result.question_fi
1832 
1833  LEFT JOIN tst_manual_fb
1834  ON tst_test_result.active_fi = tst_manual_fb.active_fi
1835  AND tst_test_result.question_fi = tst_manual_fb.question_fi
1836 
1837  WHERE tst_test_result.active_fi = %s
1838  AND tst_test_result.pass = %s
1839  ";
1840 
1841  $solutionresult = $this->db->queryF(
1842  $query,
1843  ['integer', 'integer'],
1844  [$active_id, $pass]
1845  );
1846 
1847  while ($row = $this->db->fetchAssoc($solutionresult)) {
1848  $arr_results[ $row['question_fi'] ] = $row;
1849  }
1850 
1851  $num_worked_through = count($arr_results);
1852 
1853  $IN_question_ids = $this->db->in('qpl_questions.question_id', $sequence, false, 'integer');
1854 
1855  $query = "
1856  SELECT qpl_questions.*,
1857  qpl_qst_type.type_tag,
1858  qpl_sol_sug.question_fi has_sug_sol
1859 
1860  FROM qpl_qst_type,
1861  qpl_questions
1862 
1863  LEFT JOIN qpl_sol_sug
1864  ON qpl_sol_sug.question_fi = qpl_questions.question_id
1865 
1866  WHERE qpl_qst_type.question_type_id = qpl_questions.question_type_fi
1867  AND $IN_question_ids
1868  ";
1869 
1870  $result = $this->db->query($query);
1871  $unordered = [];
1872  $key = 1;
1873  while ($row = $this->db->fetchAssoc($result)) {
1874  if (!isset($arr_results[ $row['question_id'] ])) {
1875  $percentvalue = 0.0;
1876  } else {
1877  $percentvalue = (
1878  $row['points'] ? $arr_results[$row['question_id']]['reached'] / $row['points'] : 0
1879  );
1880  }
1881  if ($percentvalue < 0) {
1882  $percentvalue = 0.0;
1883  }
1884 
1885  $data = [
1886  "nr" => "$key",
1887  "title" => ilLegacyFormElementsUtil::prepareFormOutput($row['title']),
1888  "max" => round($row['points'], 2),
1889  "reached" => round($arr_results[$row['question_id']]['reached'] ?? 0, 2),
1890  'requested_hints' => $arr_results[$row['question_id']]['requested_hints'] ?? 0,
1891  'hint_points' => $arr_results[$row['question_id']]['hint_points'] ?? 0,
1892  "percent" => sprintf("%2.2f ", ($percentvalue) * 100) . "%",
1893  "solution" => ($row['has_sug_sol']) ? assQuestion::_getSuggestedSolutionOutput($row['question_id']) : '',
1894  "type" => $row["type_tag"],
1895  "qid" => $row['question_id'],
1896  "original_id" => $row["original_id"],
1897  "workedthrough" => isset($arr_results[$row['question_id']]) ? 1 : 0,
1898  'answered' => $arr_results[$row['question_id']]['answered'] ?? 0,
1899  'finalized_evaluation' => $arr_results[$row['question_id']]['finalized_evaluation'] ?? 0,
1900  ];
1901 
1902  $unordered[ $row['question_id'] ] = $data;
1903  $key++;
1904  }
1905 
1906  $numQuestionsTotal = count($unordered);
1907 
1908  $pass_max = 0;
1909  $pass_reached = 0;
1910  $pass_requested_hints = 0;
1911  $pass_hint_points = 0;
1912 
1913  $found = [];
1914 
1915  foreach ($sequence as $qid) {
1916  // building pass point sums based on prepared data
1917  // for question that exists in users qst sequence
1918  $pass_max += round($unordered[$qid]['max'], 2);
1919  $pass_reached += round($unordered[$qid]['reached'], 2);
1920  $pass_requested_hints += $unordered[$qid]['requested_hints'];
1921  $pass_hint_points += $unordered[$qid]['hint_points'];
1922  $found[] = $unordered[$qid];
1923  }
1924 
1925  $unordered = null;
1926 
1927  if ($this->getScoreCutting() == 1) {
1928  if ($results['reached_points'] < 0) {
1929  $results['reached_points'] = 0;
1930  }
1931 
1932  if ($pass_reached < 0) {
1933  $pass_reached = 0;
1934  }
1935  }
1936 
1937  $found['pass']['total_max_points'] = $pass_max;
1938  $found['pass']['total_reached_points'] = $pass_reached;
1939  $found['pass']['total_requested_hints'] = $pass_requested_hints;
1940  $found['pass']['total_hint_points'] = $pass_hint_points;
1941  $found['pass']['percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
1942  $found['pass']['num_workedthrough'] = $num_worked_through;
1943  $found['pass']['num_questions_total'] = $numQuestionsTotal;
1944 
1945  $found["test"]["total_max_points"] = $results['max_points'];
1946  $found["test"]["total_reached_points"] = $results['reached_points'];
1947  $found["test"]["total_requested_hints"] = $results['hint_count'];
1948  $found["test"]["total_hint_points"] = $results['hint_points'];
1949  $found["test"]["result_pass"] = $results['pass'];
1950  $found['test']['result_tstamp'] = $results['tstamp'];
1951 
1952  if ((!$found['pass']['total_reached_points']) or (!$found['pass']['total_max_points'])) {
1953  $percentage = 0.0;
1954  } else {
1955  $percentage = ($found['pass']['total_reached_points'] / $found['pass']['total_max_points']) * 100.0;
1956 
1957  if ($percentage < 0) {
1958  $percentage = 0.0;
1959  }
1960  }
1961 
1962  $found["test"]["passed"] = $results['passed'];
1963 
1964  return $found;
1965  }
static _getSuggestedSolutionOutput(int $question_id)
$test_sequence
contains the test sequence data
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getResultsForActiveId(int $active_id)
$results
getScoreCutting()
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:

◆ getTextAnswer()

ilObjTest::getTextAnswer (   $active_id,
  $question_id,
  $pass = null 
)

Returns the text answer of a given user for a given question.

Parameters
integer$active_id
integer$question_id
Returns
string The answer text public

Definition at line 4325 of file class.ilObjTest.php.

References assQuestion\_getSolutionMaxPass(), and null.

Referenced by ilTestArchiver\handInParticipantUploadedResults().

4325  : string
4326  {
4327  if (($active_id) && ($question_id)) {
4328  if ($pass === null) {
4329  $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
4330  }
4331  if ($pass === null) {
4332  return '';
4333  }
4334  $query = $this->db->queryF(
4335  "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
4336  ['integer', 'integer', 'integer'],
4337  [$active_id, $question_id, $pass]
4338  );
4339  $result = $this->db->fetchAll($query);
4340  if (count($result) == 1) {
4341  return $result[0]["value1"];
4342  }
4343  }
4344  return '';
4345  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getSolutionMaxPass(int $question_id, int $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:

◆ getTimeExtensionsOfParticipants()

ilObjTest::getTimeExtensionsOfParticipants ( )

Definition at line 6942 of file class.ilObjTest.php.

References getTestId().

6942  : array
6943  {
6944  $times = [];
6945  $result = $this->db->queryF(
6946  "SELECT tst_addtime.active_fi, tst_addtime.additionaltime FROM tst_addtime, tst_active WHERE tst_addtime.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
6947  ['integer'],
6948  [$this->getTestId()]
6949  );
6950  while ($row = $this->db->fetchAssoc($result)) {
6951  $times[$row['active_fi']] = $row['additionaltime'];
6952  }
6953  return $times;
6954  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ getTitleFilenameCompliant()

ilObjTest::getTitleFilenameCompliant ( )

returns the object title prepared to be used as a filename

Definition at line 224 of file class.ilObjTest.php.

References ilFileUtils\getASCIIFilename(), and ilObject\getTitle().

224  : string
225  {
226  return ilFileUtils::getASCIIFilename($this->getTitle());
227  }
static getASCIIFilename(string $a_filename)
+ Here is the call graph for this function:

◆ getTitleOutput()

ilObjTest::getTitleOutput ( )

Definition at line 880 of file class.ilObjTest.php.

References getMainSettings().

Referenced by getQuestionTitle().

880  : int
881  {
882  return $this->getMainSettings()->getQuestionBehaviourSettings()->getQuestionTitleOutputMode();
883  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTmpCopyWizardCopyId()

ilObjTest::getTmpCopyWizardCopyId ( )

Definition at line 229 of file class.ilObjTest.php.

References $tmpCopyWizardCopyId.

Referenced by ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), and ilTestRandomQuestionSetConfig\registerClonedSourcePoolDefinitionIdMapping().

229  : ?int
230  {
232  }
int $tmpCopyWizardCopyId
+ Here is the caller graph for this function:

◆ getTotalPointsPassedArray()

ilObjTest::getTotalPointsPassedArray ( )

Returns an array with the total points of all users who passed the test This array could be used for statistics.

Returns
array The total point values public

Definition at line 2266 of file class.ilObjTest.php.

References evalTotalParticipantsArray(), getMarkSchema(), getTestResult(), and null.

2266  : array
2267  {
2268  $totalpoints_array = [];
2269  $all_users = $this->evalTotalParticipantsArray();
2270  foreach ($all_users as $active_id => $user_name) {
2271  $test_result = &$this->getTestResult($active_id);
2272  $reached = $test_result["test"]["total_reached_points"];
2273  $total = $test_result["test"]["total_max_points"];
2274  $percentage = $total != 0 ? $reached / $total : 0;
2275  $mark = $this->getMarkSchema()->getMatchingMark($percentage * 100.0);
2276 
2277  if ($mark !== null && $mark->getPassed()) {
2278  array_push($totalpoints_array, $test_result["test"]["total_reached_points"]);
2279  }
2280  }
2281  return $totalpoints_array;
2282  }
getTestResult(int $active_id, ?int $pass=null, bool $ordered_sequence=false, bool $consider_hidden_questions=true, bool $consider_optional_questions=true)
Calculates the results of a test for a given user and returns an array with all test results...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
evalTotalParticipantsArray(string $name_sort_order='asc')
+ Here is the call graph for this function:

◆ getUnfilteredEvaluationData()

ilObjTest::getUnfilteredEvaluationData ( )

Definition at line 2477 of file class.ilObjTest.php.

Referenced by getCompleteEvaluationData().

2478  {
2479  return (new ilTestEvaluationFactory($this->db, $this))
2480  ->getEvaluationData();
2481  }
+ Here is the caller graph for this function:

◆ getUsePreviousAnswers()

ilObjTest::getUsePreviousAnswers ( )

Definition at line 875 of file class.ilObjTest.php.

References getMainSettings().

875  : bool
876  {
877  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed();
878  }
+ Here is the call graph for this function:

◆ getUserData()

ilObjTest::getUserData (   $ids)

Returns a data of all users specified by id list.

Returns
array The user data "usr_id, login, lastname, firstname, clientip" of the users with id as key public

Definition at line 4538 of file class.ilObjTest.php.

References getAnonymity(), and ILIAS\Repository\lng().

4538  : array
4539  {
4540  if (!is_array($ids) || count($ids) == 0) {
4541  return [];
4542  }
4543 
4544  if ($this->getAnonymity()) {
4545  $result = $this->db->queryF(
4546  "SELECT usr_id, %s login, %s lastname, %s firstname, client_ip clientip FROM usr_data WHERE " . $this->db->in('usr_id', $ids, false, 'integer') . " ORDER BY login",
4547  ['text', 'text', 'text'],
4548  ["", $this->lng->txt("anonymous"), ""]
4549  );
4550  } else {
4551  $result = $this->db->query("SELECT usr_id, login, lastname, firstname, client_ip clientip FROM usr_data WHERE " . $this->db->in('usr_id', $ids, false, 'integer') . " ORDER BY login");
4552  }
4553 
4554  $result_array = [];
4555  while ($row = $this->db->fetchAssoc($result)) {
4556  $result_array[$row["usr_id"]] = $row;
4557  }
4558  return $result_array;
4559  }
+ Here is the call graph for this function:

◆ getUsrPassOverviewEnabled()

ilObjTest::getUsrPassOverviewEnabled ( )

Definition at line 5277 of file class.ilObjTest.php.

References getMainSettings().

5277  : bool
5278  {
5279  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getUsrPassOverviewEnabled();
5280  }
+ Here is the call graph for this function:

◆ getVisitingTimeOfParticipant()

ilObjTest::getVisitingTimeOfParticipant ( int  $active_id)

Definition at line 7571 of file class.ilObjTest.php.

7571  : array
7572  {
7573  return $this->participant_repository->getFirstAndLastVisitForActiveId($active_id);
7574  }

◆ getWorkedQuestions()

& ilObjTest::getWorkedQuestions (   $active_id,
  $pass = null 
)

Gets the id's of all questions a user already worked through.

Returns
array The question id's of the questions already worked through public

Definition at line 1617 of file class.ilObjTest.php.

1617  : array
1618  {
1619  if (is_null($pass)) {
1620  $result = $this->db->queryF(
1621  "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
1622  ['integer','integer'],
1623  [$active_id, 0]
1624  );
1625  } else {
1626  $result = $this->db->queryF(
1627  "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
1628  ['integer','integer'],
1629  [$active_id, $pass]
1630  );
1631  }
1632  $result_array = [];
1633  while ($row = $this->db->fetchAssoc($result)) {
1634  array_push($result_array, $row["question_fi"]);
1635  }
1636  return $result_array;
1637  }

◆ getWorkingTimeOfParticipantForPass()

ilObjTest::getWorkingTimeOfParticipantForPass ( int  $active_id,
int  $pass 
)

Definition at line 2114 of file class.ilObjTest.php.

Referenced by updateTestPassResults().

2114  : int
2115  {
2116  $result = $this->db->queryF(
2117  "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
2118  ['integer','integer'],
2119  [$active_id, $pass]
2120  );
2121  $time = 0;
2122  while ($row = $this->db->fetchAssoc($result)) {
2123  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
2124  $epoch_1 = mktime(
2125  (int) $matches[4],
2126  (int) $matches[5],
2127  (int) $matches[6],
2128  (int) $matches[2],
2129  (int) $matches[3],
2130  (int) $matches[1]
2131  );
2132  preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
2133  $epoch_2 = mktime(
2134  (int) $matches[4],
2135  (int) $matches[5],
2136  (int) $matches[6],
2137  (int) $matches[2],
2138  (int) $matches[3],
2139  (int) $matches[1]
2140  );
2141  $time += ($epoch_2 - $epoch_1);
2142  }
2143  return $time;
2144  }
+ Here is the caller graph for this function:

◆ getXMLZip()

ilObjTest::getXMLZip ( )

Get zipped xml file for test.

Definition at line 6479 of file class.ilObjTest.php.

6479  : string
6480  {
6481  return $this->export_factory->getExporter($this, 'xml')
6482  ->write();
6483  }

◆ hasAnyTestResult()

ilObjTest::hasAnyTestResult ( ilTestSession  $test_session)

Definition at line 5068 of file class.ilObjTest.php.

References ilTestSession\getActiveId(), and ilTestSession\getLastFinishedPass().

5068  : bool
5069  {
5070  $passSelector = new ilTestPassesSelector($this->db, $this);
5071 
5072  $passSelector->setActiveId($test_session->getActiveId());
5073  $passSelector->setLastFinishedPass($test_session->getLastFinishedPass());
5074 
5075  return $passSelector->hasExistingPasses();
5076  }
+ Here is the call graph for this function:

◆ hasNrOfTriesRestriction()

ilObjTest::hasNrOfTriesRestriction ( )

returns if the numbers of tries have to be checked

Definition at line 4687 of file class.ilObjTest.php.

References getNrOfTries().

Referenced by isExecutable().

4687  : bool
4688  {
4689  return $this->getNrOfTries() != 0;
4690  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasQuestionsWithoutQuestionpool()

ilObjTest::hasQuestionsWithoutQuestionpool ( )

Definition at line 6629 of file class.ilObjTest.php.

References getQuestionTitlesAndIndexes().

6629  : bool
6630  {
6632 
6633  $IN_questions = $this->db->in('q1.question_id', array_keys($questions), false, 'integer');
6634 
6635  $query = "
6636  SELECT count(q1.question_id) cnt
6637 
6638  FROM qpl_questions q1
6639 
6640  INNER JOIN qpl_questions q2
6641  ON q2.question_id = q1.original_id
6642 
6643  WHERE $IN_questions
6644  AND q1.obj_fi = q2.obj_fi
6645  ";
6646  $rset = $this->db->query($query);
6647  $row = $this->db->fetchAssoc($rset);
6648 
6649  return $row['cnt'] > 0;
6650  }
array $questions
getQuestionTitlesAndIndexes()
Returns the titles of the test questions in question sequence.
+ Here is the call graph for this function:

◆ insertManualFeedback()

ilObjTest::insertManualFeedback ( int  $active_id,
int  $question_id,
int  $pass,
?string  $feedback,
bool  $finalized,
array  $feedback_old 
)
private

Definition at line 6166 of file class.ilObjTest.php.

References ilObject\$user, ilRTE\_replaceMediaObjectImageSrc(), ilObject\getRefId(), ILIAS\Repository\logger(), null, and ILIAS\Repository\user().

Referenced by saveManualFeedback().

6173  : void {
6174  $next_id = $this->db->nextId('tst_manual_fb');
6175  $user = $this->user->getId();
6176  $finalized_time = time();
6177 
6178  $update_default = [
6179  'manual_feedback_id' => [ 'integer', $next_id],
6180  'active_fi' => [ 'integer', $active_id],
6181  'question_fi' => [ 'integer', $question_id],
6182  'pass' => [ 'integer', $pass],
6183  'feedback' => [ 'clob', $feedback ? ilRTE::_replaceMediaObjectImageSrc($feedback, 0) : null],
6184  'tstamp' => [ 'integer', time()]
6185  ];
6186 
6187  if ($feedback_old !== [] && (int) $feedback_old['finalized_evaluation'] === 1) {
6188  $user = $feedback_old['finalized_by_usr_id'];
6189  $finalized_time = $feedback_old['finalized_tstamp'];
6190  }
6191 
6192  if ($finalized === false) {
6193  $update_default['finalized_evaluation'] = ['integer', 0];
6194  $update_default['finalized_by_usr_id'] = ['integer', 0];
6195  $update_default['finalized_tstamp'] = ['integer', 0];
6196  } elseif ($finalized === true) {
6197  $update_default['finalized_evaluation'] = ['integer', 1];
6198  $update_default['finalized_by_usr_id'] = ['integer', $user];
6199  $update_default['finalized_tstamp'] = ['integer', $finalized_time];
6200  }
6201 
6202  $this->db->insert('tst_manual_fb', $update_default);
6203 
6204  if ($this->logger->isLoggingEnabled()) {
6205  $this->logger->logScoringInteraction(
6206  $this->logger->getInteractionFactory()->buildScoringInteraction(
6207  $this->getRefId(),
6208  $question_id,
6209  $this->user->getId(),
6210  self::_getUserIdFromActiveId($active_id),
6211  TestScoringInteractionTypes::QUESTION_GRADED,
6212  [
6213  AdditionalInformationGenerator::KEY_EVAL_FINALIZED => $this->logger
6214  ->getAdditionalInformationGenerator()->getTrueFalseTagForBool($finalized),
6215  AdditionalInformationGenerator::KEY_FEEDBACK => $feedback ? ilRTE::_replaceMediaObjectImageSrc($feedback, 0) : ''
6216  ]
6217  )
6218  );
6219  }
6220  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilObjUser $user
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestion()

ilObjTest::insertQuestion ( int  $question_id,
bool  $link_only = false 
)

Definition at line 1358 of file class.ilObjTest.php.

References $data, duplicateQuestionForTest(), ilObject\getRefId(), getTestId(), assQuestion\instantiateQuestion(), loadQuestions(), ILIAS\Repository\logger(), saveCompleteStatus(), and ILIAS\Repository\user().

Referenced by copyQuestions().

1358  : int
1359  {
1360  if ($link_only) {
1361  $duplicate_id = $question_id;
1362  } else {
1363  $duplicate_id = $this->duplicateQuestionForTest($question_id);
1364  }
1365 
1366  // get maximum sequence index in test
1367  $result = $this->db->queryF(
1368  "SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
1369  ['integer'],
1370  [$this->getTestId()]
1371  );
1372  $sequence = 1;
1373 
1374  if ($result->numRows() == 1) {
1375  $data = $this->db->fetchObject($result);
1376  $sequence = $data->seq + 1;
1377  }
1378 
1379  $next_id = $this->db->nextId('tst_test_question');
1380  $this->db->manipulateF(
1381  "INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
1382  ['integer', 'integer','integer','integer','integer'],
1383  [$next_id, $this->getTestId(), $duplicate_id, $sequence, time()]
1384  );
1385  // remove test_active entries, because test has changed
1386  $this->db->manipulateF(
1387  "DELETE FROM tst_active WHERE test_fi = %s",
1388  ['integer'],
1389  [$this->getTestId()]
1390  );
1391  $this->loadQuestions();
1392  $this->saveCompleteStatus($this->question_set_config_factory->getQuestionSetConfig());
1393 
1394  if ($this->logger->isLoggingEnabled()) {
1395  $this->logger->logTestAdministrationInteraction(
1396  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
1397  $this->getRefId(),
1398  $this->user->getId(),
1399  TestAdministrationInteractionTypes::QUESTION_ADDED,
1400  [
1401  AdditionalInformationGenerator::KEY_QUESTION_ID => $question_id
1402  ] + (assQuestion::instantiateQuestion($question_id))
1403  ->toLog($this->logger->getAdditionalInformationGenerator())
1404  )
1405  );
1406  }
1407 
1408  return $duplicate_id;
1409  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
saveCompleteStatus(ilTestQuestionSetConfig $test_question_set_config)
getTestId()
Gets the database id of the additional test data.
static instantiateQuestion(int $question_id)
duplicateQuestionForTest($question_id)
Takes a question and creates a copy of the question for use in the test.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inviteUser()

ilObjTest::inviteUser (   $user_id,
  $client_ip = "" 
)

Invites a user to a test.

Parameters
integer$user_idThe database id of the invited user public

Definition at line 4592 of file class.ilObjTest.php.

References $user_id, getTestId(), and null.

4593  {
4594  $this->db->manipulateF(
4595  "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
4596  ['integer', 'integer'],
4597  [$this->getTestId(), $user_id]
4598  );
4599  $this->db->manipulateF(
4600  "INSERT INTO tst_invited_user (test_fi, user_fi, ip_range_from, ip_range_to, tstamp) VALUES (%s, %s, %s, %s, %s)",
4601  ['integer', 'integer', 'text', 'text', 'integer'],
4602  [$this->getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : null, (strlen($client_ip)) ? $client_ip : null,time()]
4603  );
4604  }
getTestId()
Gets the database id of the additional test data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isActivationLimited()

ilObjTest::isActivationLimited ( )

Definition at line 6704 of file class.ilObjTest.php.

References $activation_limited.

Referenced by addDefaults(), saveToDb(), and toXML().

6704  : ?bool
6705  {
6707  }
bool $activation_limited
+ Here is the caller graph for this function:

◆ isActiveTestSubmitted()

ilObjTest::isActiveTestSubmitted (   $user_id = null)

returns if the active for user_id has been submitted

Definition at line 4670 of file class.ilObjTest.php.

References $user_id, getTestId(), and ILIAS\Repository\user().

4670  : bool
4671  {
4672  if (!is_numeric($user_id)) {
4673  $user_id = $this->user->getId();
4674  }
4675 
4676  $result = $this->db->queryF(
4677  "SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
4678  ['integer', 'integer', 'integer'],
4679  [$this->getTestId(), $user_id, 1]
4680  );
4681  return $result->numRows() == 1;
4682  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ isBlockPassesAfterPassedEnabled()

ilObjTest::isBlockPassesAfterPassedEnabled ( )

Definition at line 856 of file class.ilObjTest.php.

References getMainSettings().

Referenced by isExecutable().

856  : bool
857  {
858  return $this->getMainSettings()->getTestBehaviourSettings()->getBlockAfterPassedEnabled();
859  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isComplete()

ilObjTest::isComplete ( ilTestQuestionSetConfig  $test_question_set_config)
final

Definition at line 425 of file class.ilObjTest.php.

References getMarkSchema(), ilTestQuestionSetConfig\isQuestionSetConfigured(), and null.

Referenced by saveCompleteStatus().

425  : bool
426  {
427  if ($this->getMarkSchema() === null
428  || $this->getMarkSchema()->getMarkSteps() === []) {
429  return false;
430  }
431 
432  if (!$test_question_set_config->isQuestionSetConfigured()) {
433  return false;
434  }
435 
436  return true;
437  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEndingTimeEnabled()

ilObjTest::isEndingTimeEnabled ( )

Definition at line 961 of file class.ilObjTest.php.

References getMainSettings().

Referenced by endingTimeReached().

961  : bool
962  {
963  return $this->getMainSettings()->getAccessSettings()->getEndTimeEnabled();
964  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isExecutable()

ilObjTest::isExecutable (   $test_session,
  $user_id,
  $allow_pass_increase = false 
)

Checks if the test is executable by the given user.

Parameters
$test_session
integer$user_idThe user id
bool$allowPassIncrease
Returns
array Result array
Exceptions
ilDateTimeException

Definition at line 4971 of file class.ilObjTest.php.

References $user_id, ilObjTestAccess\_isPassed(), endingTimeReached(), ilDatePresentation\formatDate(), getActiveIdOfUser(), getEnableProcessingTime(), getEndingTime(), ilObject\getId(), getNrOfTries(), ilObject\getObjectProperties(), getStartingTime(), getStartingTimeOfUser(), hasNrOfTriesRestriction(), IL_CAL_UNIX, isBlockPassesAfterPassedEnabled(), isMaxProcessingTimeReached(), isNextPassAllowed(), ILIAS\Repository\lng(), and startingTimeReached().

4971  : array
4972  {
4973  $result = [
4974  "executable" => true,
4975  "errormessage" => ""
4976  ];
4977 
4978  if (!$this->getObjectProperties()->getPropertyIsOnline()->getIsOnline()) {
4979  $result["executable"] = false;
4980  $result["errormessage"] = $this->lng->txt('autosave_failed') . ': ' . $this->lng->txt('offline');
4981  return $result;
4982  }
4983 
4984  if (!$this->startingTimeReached()) {
4985  $result["executable"] = false;
4986  $result["errormessage"] = sprintf($this->lng->txt("detail_starting_time_not_reached"), ilDatePresentation::formatDate(new ilDateTime($this->getStartingTime(), IL_CAL_UNIX)));
4987  return $result;
4988  }
4989  if ($this->endingTimeReached()) {
4990  $result["executable"] = false;
4991  $result["errormessage"] = sprintf($this->lng->txt("detail_ending_time_reached"), ilDatePresentation::formatDate(new ilDateTime($this->getEndingTime(), IL_CAL_UNIX)));
4992  return $result;
4993  }
4994 
4995  $active_id = $this->getActiveIdOfUser($user_id);
4996 
4997  if ($this->getEnableProcessingTime()
4998  && $active_id > 0
4999  && ($starting_time = $this->getStartingTimeOfUser($active_id)) !== false
5000  && $this->isMaxProcessingTimeReached($starting_time, $active_id)) {
5001  $result["executable"] = false;
5002  $result["errormessage"] = $this->lng->txt("detail_max_processing_time_reached");
5003  return $result;
5004  }
5005 
5006  $testPassesSelector = new ilTestPassesSelector($this->db, $this);
5007  $testPassesSelector->setActiveId($active_id);
5008  $testPassesSelector->setLastFinishedPass($test_session->getLastFinishedPass());
5009 
5010  if ($this->hasNrOfTriesRestriction() && ($active_id > 0)) {
5011  $closedPasses = $testPassesSelector->getClosedPasses();
5012 
5013  if (count($closedPasses) >= $this->getNrOfTries()) {
5014  $result["executable"] = false;
5015  $result["errormessage"] = $this->lng->txt("maximum_nr_of_tries_reached");
5016  return $result;
5017  }
5018 
5019  if ($this->isBlockPassesAfterPassedEnabled() && !$testPassesSelector->openPassExists()) {
5020  if (ilObjTestAccess::_isPassed($user_id, $this->getId())) {
5021  $result['executable'] = false;
5022  $result['errormessage'] = $this->lng->txt("tst_addit_passes_blocked_after_passed_msg");
5023  return $result;
5024  }
5025  }
5026  }
5027 
5028  $next_pass_allowed_timestamp = 0;
5029  if (!$this->isNextPassAllowed($testPassesSelector, $next_pass_allowed_timestamp)) {
5030  $date = ilDatePresentation::formatDate(new ilDateTime($next_pass_allowed_timestamp, IL_CAL_UNIX));
5031 
5032  $result['executable'] = false;
5033  $result['errormessage'] = sprintf($this->lng->txt('wait_for_next_pass_hint_msg'), $date);
5034  return $result;
5035  }
5036  return $result;
5037  }
isNextPassAllowed(ilTestPassesSelector $testPassesSelector, int &$next_pass_allowed_timestamp)
isBlockPassesAfterPassedEnabled()
const IL_CAL_UNIX
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
static _isPassed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id...
getStartingTimeOfUser($active_id, $pass=null)
Returns the unix timestamp of the time a user started a test.
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
endingTimeReached()
Returns true if the ending time of a test is reached An ending time is not available for self assessm...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
isMaxProcessingTimeReached(int $starting_time, int $active_id)
Returns whether the maximum processing time for a test is reached or not.
+ Here is the call graph for this function:

◆ isFixedTest()

ilObjTest::isFixedTest ( )

Returns the fact wether this test is a fixed question set test or not.

Returns
boolean $isFixedTest

Definition at line 7044 of file class.ilObjTest.php.

References getQuestionSetType().

Referenced by ILIAS\Test\ExportImport\Factory\getExporter(), and ILIAS\Test\Questions\Properties\DatabaseRepository\getQuestionPropertiesForTest().

7044  : bool
7045  {
7046  return $this->getQuestionSetType() == self::QUESTION_SET_TYPE_FIXED;
7047  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFollowupQuestionAnswerFixationEnabled()

ilObjTest::isFollowupQuestionAnswerFixationEnabled ( )

Definition at line 7165 of file class.ilObjTest.php.

References getMainSettings().

7165  : bool
7166  {
7167  return $this->getMainSettings()->getQuestionBehaviourSettings()->getLockAnswerOnNextQuestionEnabled();
7168  }
+ Here is the call graph for this function:

◆ isForceInstantFeedbackEnabled()

ilObjTest::isForceInstantFeedbackEnabled ( )

Definition at line 7175 of file class.ilObjTest.php.

References getMainSettings().

7175  : ?bool
7176  {
7177  return $this->getMainSettings()->getQuestionBehaviourSettings()->getForceInstantFeedbackOnNextQuestion();
7178  }
+ Here is the call graph for this function:

◆ isHighscoreAnon()

ilObjTest::isHighscoreAnon ( )

Gets if the highscores should be displayed anonymized.

Note: This method considers the global anonymity switch. If you need access to the users setting,

See also
getHighscoreAnon()
Returns
boolean True, if output is anonymized.

Definition at line 6807 of file class.ilObjTest.php.

References getAnonymity(), and getHighscoreAnon().

6807  : bool
6808  {
6809  return $this->getAnonymity() == 1 || $this->getHighscoreAnon();
6810  }
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
+ Here is the call graph for this function:

◆ isHTML()

ilObjTest::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean public

Definition at line 5433 of file class.ilObjTest.php.

Referenced by addQTIMaterial().

5433  : bool
5434  {
5435  if (preg_match("/<[^>]*?>/", $a_text)) {
5436  return true;
5437  } else {
5438  return false;
5439  }
5440  }
+ Here is the caller graph for this function:

◆ isInstantFeedbackAnswerFixationEnabled()

ilObjTest::isInstantFeedbackAnswerFixationEnabled ( )

Definition at line 7170 of file class.ilObjTest.php.

References getMainSettings().

7170  : bool
7171  {
7172  return $this->getMainSettings()->getQuestionBehaviourSettings()->getLockAnswerOnInstantFeedbackEnabled();
7173  }
+ Here is the call graph for this function:

◆ isMaxProcessingTimeReached()

ilObjTest::isMaxProcessingTimeReached ( int  $starting_time,
int  $active_id 
)

Returns whether the maximum processing time for a test is reached or not.

Returns
bool TRUE if the maxium processing time is reached, FALSE if the maximum processing time is not reached or no maximum processing time is given

Definition at line 5123 of file class.ilObjTest.php.

References getEnableProcessingTime(), and getProcessingTimeInSeconds().

Referenced by isExecutable().

5123  : bool
5124  {
5125  if (!$this->getEnableProcessingTime()) {
5126  return false;
5127  }
5128 
5129  $processing_time = $this->getProcessingTimeInSeconds($active_id);
5130  $now = time();
5131  if ($now > ($starting_time + $processing_time)) {
5132  return true;
5133  }
5134 
5135  return false;
5136  }
getProcessingTimeInSeconds(int $active_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNextPassAllowed()

ilObjTest::isNextPassAllowed ( ilTestPassesSelector  $testPassesSelector,
int &  $next_pass_allowed_timestamp 
)

Definition at line 5039 of file class.ilObjTest.php.

References ilTestPassesSelector\getLastFinishedPass(), ilTestPassesSelector\getLastFinishedPassTimestamp(), getMainSettings(), and null.

Referenced by isExecutable().

5039  : bool
5040  {
5041  $waiting_between_passes = $this->getMainSettings()->getTestBehaviourSettings()->getPassWaiting();
5042  $last_finished_pass_timestamp = $testPassesSelector->getLastFinishedPassTimestamp();
5043 
5044  if (
5045  $this->getMainSettings()->getTestBehaviourSettings()->getPassWaitingEnabled()
5046  && ($waiting_between_passes !== '')
5047  && ($testPassesSelector->getLastFinishedPass() !== null)
5048  && ($last_finished_pass_timestamp !== null)
5049  ) {
5050  $time_values = explode(':', $waiting_between_passes);
5051  $next_pass_allowed_timestamp = strtotime('+ ' . $time_values[0] . ' Days + ' . $time_values[1] . ' Hours' . $time_values[2] . ' Minutes', $last_finished_pass_timestamp);
5052  return (time() > $next_pass_allowed_timestamp);
5053  }
5054 
5055  return true;
5056  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNrOfTriesReached()

ilObjTest::isNrOfTriesReached (   $tries)

returns if number of tries are reached

Deprecated:
: tries field differs per situation, outside a pass it's the number of tries, inside a pass it's the current pass number.

Definition at line 4698 of file class.ilObjTest.php.

References getNrOfTries().

4698  : bool
4699  {
4700  return $tries >= $this->getNrOfTries();
4701  }
+ Here is the call graph for this function:

◆ isOfferingQuestionHintsEnabled()

ilObjTest::isOfferingQuestionHintsEnabled ( )

Definition at line 6689 of file class.ilObjTest.php.

References getMainSettings().

Referenced by ilTestArchiver\getResultsOfUserOutput().

6689  : bool
6690  {
6691  return $this->getMainSettings()->getQuestionBehaviourSettings()->getQuestionHintsEnabled();
6692  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOnline()

ilObjTest::isOnline ( )

Definition at line 6684 of file class.ilObjTest.php.

References $online.

6684  : bool
6685  {
6686  return $this->online;
6687  }

◆ isParticipantsLastPassActive()

static ilObjTest::isParticipantsLastPassActive ( int  $test_ref_id,
int  $user_id 
)
static

Definition at line 7181 of file class.ilObjTest.php.

References $DIC, $ilDB, $test_sequence, and ilObjectFactory\getInstanceByRefId().

7181  : bool
7182  {
7183  global $DIC;
7184  $ilDB = $DIC['ilDB'];
7185  $ilUser = $DIC['ilUser'];
7186 
7187  $test_obj = ilObjectFactory::getInstanceByRefId($test_ref_id, false);
7188 
7189  $active_id = $test_obj->getActiveIdOfUser($user_id);
7190 
7191  $test_session_factory = new ilTestSessionFactory($test_obj, $ilDB, $ilUser);
7192 
7193  // Added temporarily bugfix smeyer
7194  $test_session_factory->reset();
7195 
7196  $test_sequence_factory = new ilTestSequenceFactory($test_obj, $ilDB, TestDIC::dic()['question.general_properties.repository']);
7197 
7198  $test_session = $test_session_factory->getSession($active_id);
7199  $test_sequence = $test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $test_session->getPass());
7200  $test_sequence->loadFromDb();
7201 
7202  return $test_sequence->hasSequence();
7203  }
$test_sequence
contains the test sequence data
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ isPassDeletionAllowed()

ilObjTest::isPassDeletionAllowed ( )

Definition at line 6892 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

6892  : bool
6893  {
6894  return $this->getScoreSettings()->getResultSummarySettings()->getPassDeletionAllowed();
6895  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPasswordEnabled()

ilObjTest::isPasswordEnabled ( )

Definition at line 992 of file class.ilObjTest.php.

References getMainSettings().

992  : bool
993  {
994  return $this->getMainSettings()->getAccessSettings()->getPasswordEnabled();
995  }
+ Here is the call graph for this function:

◆ isPluginActive()

ilObjTest::isPluginActive (   $a_pname)

Checks wheather or not a question plugin with a given name is active.

Parameters
string$a_pnameThe plugin name public

Definition at line 6324 of file class.ilObjTest.php.

References ilComponentInfo\TYPE_MODULES.

6324  : bool
6325  {
6326  if (!$this->component_repository->getComponentByTypeAndName(
6328  'TestQuestionPool'
6329  )->getPluginSlotById('qst')->hasPluginName($a_pname)) {
6330  return false;
6331  }
6332 
6333  return $this->component_repository
6334  ->getComponentByTypeAndName(
6336  'TestQuestionPool'
6337  )
6338  ->getPluginSlotById(
6339  'qst'
6340  )
6341  ->getPluginByName(
6342  $a_pname
6343  )->isActive();
6344  }

◆ isPostponingEnabled()

ilObjTest::isPostponingEnabled ( )

Definition at line 736 of file class.ilObjTest.php.

References getMainSettings().

736  : bool
737  {
738  return $this->getMainSettings()->getParticipantFunctionalitySettings()->getPostponedQuestionsMoveToEnd();
739  }
+ Here is the call graph for this function:

◆ isPreviousSolutionReuseEnabled()

ilObjTest::isPreviousSolutionReuseEnabled (   $active_id)

Definition at line 885 of file class.ilObjTest.php.

References $res, and ILIAS\Repository\user().

885  : bool
886  {
887  $result = $this->db->queryF(
888  "SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
889  ["integer"],
890  [$active_id]
891  );
892  if ($result->numRows()) {
893  $row = $this->db->fetchAssoc($result);
894  $test_allows_reuse = $row["use_previous_answers"];
895  }
896 
897  if ($test_allows_reuse === '1') {
898  $res = $this->user->getPref("tst_use_previous_answers");
899  if ($res === '1') {
900  return true;
901  }
902  }
903  return false;
904  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ isRandomTest()

ilObjTest::isRandomTest ( )

Returns the fact wether this test is a random questions test or not.

Returns
boolean $isRandomTest

Definition at line 7054 of file class.ilObjTest.php.

References getQuestionSetType().

Referenced by createTestSequence(), getAllQuestions(), getAnsweredQuestionCount(), getExistingQuestions(), getQuestionCount(), getQuestionCountWithoutReloading(), ILIAS\Test\Questions\Properties\DatabaseRepository\getQuestionPropertiesForTest(), getQuestionsOfPass(), getQuestionsOfTest(), loadQuestions(), removeQuestionWithResults(), and removeTestResultsByActiveIds().

7054  : bool
7055  {
7056  return $this->getQuestionSetType() == self::QUESTION_SET_TYPE_RANDOM;
7057  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRedirectModeKiosk()

ilObjTest::isRedirectModeKiosk ( )

Definition at line 977 of file class.ilObjTest.php.

References getMainSettings().

977  : bool
978  {
979  return $this->getMainSettings()->getFinishingSettings()->getRedirectionMode() === self::REDIRECT_KIOSK;
980  }
+ Here is the call graph for this function:

◆ isRedirectModeNone()

ilObjTest::isRedirectModeNone ( )

Definition at line 982 of file class.ilObjTest.php.

References getMainSettings().

982  : bool
983  {
984  return $this->getMainSettings()->getFinishingSettings()->getRedirectionMode() === self::REDIRECT_NONE;
985  }
+ Here is the call graph for this function:

◆ isScoreReportingEnabled()

ilObjTest::isScoreReportingEnabled ( )

Definition at line 741 of file class.ilObjTest.php.

References getScoreSettings().

741  : bool
742  {
743  return $this->getScoreSettings()->getResultSummarySettings()->getScoreReporting()->isReportingEnabled();
744  }
+ Here is the call graph for this function:

◆ isShowExamIdInTestPassEnabled()

ilObjTest::isShowExamIdInTestPassEnabled ( )

Definition at line 7015 of file class.ilObjTest.php.

References getMainSettings().

7015  : bool
7016  {
7017  return $this->getMainSettings()->getTestBehaviourSettings()->getExamIdInTestAttemptEnabled();
7018  }
+ Here is the call graph for this function:

◆ isShowExamIdInTestResultsEnabled()

ilObjTest::isShowExamIdInTestResultsEnabled ( )

Definition at line 7020 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by ilTestArchiver\getResultsOfUserOutput().

7020  : bool
7021  {
7022  return $this->getScoreSettings()->getResultDetailsSettings()->getShowExamIdInTestResults();
7023  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShowGradingMarkEnabled()

ilObjTest::isShowGradingMarkEnabled ( )

Definition at line 7160 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

7160  : bool
7161  {
7162  return $this->getScoreSettings()->getResultSummarySettings()->getShowGradingMarkEnabled();
7163  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShowGradingStatusEnabled()

ilObjTest::isShowGradingStatusEnabled ( )

Definition at line 7155 of file class.ilObjTest.php.

References getScoreSettings().

Referenced by toXML().

7155  : bool
7156  {
7157  return $this->getScoreSettings()->getResultSummarySettings()->getShowGradingStatusEnabled();
7158  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjTest::isSkillManagementGloballyActivated ( )
static

Definition at line 7144 of file class.ilObjTest.php.

References null.

Referenced by ilTestSkillAdministrationGUI\isAccessDenied().

7144  : ?bool
7145  {
7146  if (self::$isSkillManagementGloballyActivated === null) {
7147  $skmgSet = new ilSkillManagementSettings();
7148 
7149  self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
7150  }
7151 
7152  return self::$isSkillManagementGloballyActivated;
7153  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjTest::isSkillServiceEnabled ( )

Definition at line 7113 of file class.ilObjTest.php.

References getMainSettings().

7113  : bool
7114  {
7115  return $this->getMainSettings()->getAdditionalSettings()->getSkillsServiceEnabled();
7116  }
+ Here is the call graph for this function:

◆ isSkillServiceToBeConsidered()

ilObjTest::isSkillServiceToBeConsidered ( )

Returns whether this test must consider skills, usually by providing appropriate extensions in the user interface components.

Skills must be considered if skill management is globally enabled and this object has the skill service enabled as well.

See also
isSkillServiceEnabled()
isSkillManagementGloballyActivated()
Returns
boolean whether this test takes skills into account.

Definition at line 7129 of file class.ilObjTest.php.

References getMainSettings().

7129  : bool
7130  {
7131  if (!$this->getMainSettings()->getAdditionalSettings()->getSkillsServiceEnabled()) {
7132  return false;
7133  }
7134 
7135  if (!self::isSkillManagementGloballyActivated()) {
7136  return false;
7137  }
7138 
7139  return true;
7140  }
+ Here is the call graph for this function:

◆ isStartingTimeEnabled()

ilObjTest::isStartingTimeEnabled ( )

Definition at line 950 of file class.ilObjTest.php.

References getMainSettings().

Referenced by startingTimeReached().

950  : bool
951  {
952  return $this->getMainSettings()->getAccessSettings()->getStartTimeEnabled();
953  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTestFinished()

ilObjTest::isTestFinished (   $active_id)

returns if the active for user_id has been submitted

Definition at line 4657 of file class.ilObjTest.php.

Referenced by isTestFinishedToViewResults().

4657  : bool
4658  {
4659  $result = $this->db->queryF(
4660  "SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
4661  ['integer', 'integer'],
4662  [$active_id, 1]
4663  );
4664  return $result->numRows() == 1;
4665  }
+ Here is the caller graph for this function:

◆ isTestFinishedToViewResults()

ilObjTest::isTestFinishedToViewResults (   $active_id,
  $currentpass 
)

Returns true if an active user completed a test pass and did not start a new pass.

Parameters
integer$active_idThe active id of the user
integer$currentpassThe current test pass of the user
Returns
boolean true if an active user completed a test pass and did not start a new pass, false otherwise public

Definition at line 1647 of file class.ilObjTest.php.

References isTestFinished(), and lookupPassResultsUpdateTimestamp().

1647  : bool
1648  {
1649  $num = ilObjTest::lookupPassResultsUpdateTimestamp($active_id, $currentpass);
1650  return ((($currentpass > 0) && ($num == 0)) || $this->isTestFinished($active_id)) ? true : false;
1651  }
isTestFinished($active_id)
returns if the active for user_id has been submitted
static lookupPassResultsUpdateTimestamp($active_id, $pass)
+ Here is the call graph for this function:

◆ isTestQuestion()

ilObjTest::isTestQuestion ( int  $question_id)

Definition at line 5183 of file class.ilObjTest.php.

References getTestQuestions().

5183  : bool
5184  {
5185  foreach ($this->getTestQuestions() as $questionData) {
5186  if ($questionData['question_id'] != $question_id) {
5187  continue;
5188  }
5189 
5190  return true;
5191  }
5192 
5193  return false;
5194  }
+ Here is the call graph for this function:

◆ loadFromDb()

ilObjTest::loadFromDb ( )

Definition at line 607 of file class.ilObjTest.php.

References $data, ilObject\getId(), ilObjectActivation\getItem(), loadQuestions(), setActivationEndingTime(), setActivationLimited(), setActivationStartingTime(), setActivationVisibility(), setTestId(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by cloneObject(), fromXML(), and read().

607  : void
608  {
609  $result = $this->db->queryF(
610  "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
611  ['integer'],
612  [$this->getId()]
613  );
614  if ($result->numRows() === 1) {
615  $data = $this->db->fetchObject($result);
616  $this->setTestId($data->test_id);
617  $this->loadQuestions();
618  }
619 
620  // moved activation to ilObjectActivation
621  if (isset($this->ref_id)) {
622  $activation = ilObjectActivation::getItem($this->ref_id);
623  switch ($activation["timing_type"]) {
625  $this->setActivationLimited(true);
626  $this->setActivationStartingTime($activation["timing_start"]);
627  $this->setActivationEndingTime($activation["timing_end"]);
628  $this->setActivationVisibility($activation["visible"]);
629  break;
630 
631  default:
632  $this->setActivationLimited(false);
633  break;
634  }
635  }
636  }
setActivationStartingTime(?int $starting_time=null)
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
setActivationLimited($a_value)
setActivationEndingTime(?int $ending_time=null)
setTestId($a_id)
Sets the test ID.
setActivationVisibility($a_value)
static getItem(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadQuestions()

ilObjTest::loadQuestions ( int  $active_id = 0,
?int  $pass = null 
)

Load the test question id's from the database.

Definition at line 642 of file class.ilObjTest.php.

References $data, getActiveIdOfUser(), isRandomTest(), and ILIAS\Repository\user().

Referenced by getAllQuestions(), getAnsweredQuestionCount(), getQuestionCount(), insertQuestion(), loadFromDb(), questionMoveDown(), questionMoveUp(), reindexFixedQuestionOrdering(), and setQuestionOrder().

642  : void
643  {
644  $this->questions = [];
645  if ($this->isRandomTest()) {
646  if ($active_id === 0) {
647  $active_id = $this->getActiveIdOfUser($this->user->getId());
648  }
649  if (is_null($pass)) {
650  $pass = self::_getPass($active_id);
651  }
652  $result = $this->db->queryF(
653  'SELECT tst_test_rnd_qst.* '
654  . 'FROM tst_test_rnd_qst, qpl_questions '
655  . 'WHERE tst_test_rnd_qst.active_fi = %s '
656  . 'AND qpl_questions.question_id = tst_test_rnd_qst.question_fi '
657  . 'AND tst_test_rnd_qst.pass = %s '
658  . 'ORDER BY sequence',
659  ['integer', 'integer'],
660  [$active_id, $pass]
661  );
662  } else {
663  $result = $this->db->queryF(
664  'SELECT tst_test_question.* '
665  . 'FROM tst_test_question, qpl_questions '
666  . 'WHERE tst_test_question.test_fi = %s '
667  . 'AND qpl_questions.question_id = tst_test_question.question_fi '
668  . 'ORDER BY sequence',
669  ['integer'],
670  [$this->test_id]
671  );
672  }
673  $index = 1;
674  if ($this->test_id !== -1) {
675  //Omit loading of questions for non-id'ed test
676  while ($data = $this->db->fetchAssoc($result)) {
677  $this->questions[$index++] = $data["question_fi"];
678  }
679  }
680  }
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupExamId()

static ilObjTest::lookupExamId (   $active_id,
  $pass 
)
static

Definition at line 6979 of file class.ilObjTest.php.

References $DIC, $ilDB, and null.

Referenced by ilTestArchiver\getResultsOfUserOutput(), ilTestPlayerAbstractGUI\outQuestionSummaryCmd(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), ilTestServiceGUI\populateExamId(), ilTestPlayerAbstractGUI\prepareTestPage(), and ilTestSubmissionReviewGUI\show().

6980  {
6981  global $DIC;
6982  $ilDB = $DIC['ilDB'];
6983 
6984  $exam_id_query = 'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
6985  $exam_id_result = $ilDB->queryF($exam_id_query, [ 'integer', 'integer' ], [ $active_id, $pass ]);
6986  if ($ilDB->numRows($exam_id_result) == 1) {
6987  $exam_id_row = $ilDB->fetchAssoc($exam_id_result);
6988 
6989  if ($exam_id_row['exam_id'] != null) {
6990  return $exam_id_row['exam_id'];
6991  }
6992  }
6993 
6994  return null;
6995  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupPassResultsUpdateTimestamp()

static ilObjTest::lookupPassResultsUpdateTimestamp (   $active_id,
  $pass 
)
static
Parameters
int$active_id
int$pass
Returns
int

Definition at line 4921 of file class.ilObjTest.php.

References $DIC, and $ilDB.

Referenced by ILIAS\Test\ExportImport\ResultsExportExcel\addResultsHeader(), ilTestService\getPassOverviewData(), and isTestFinishedToViewResults().

4921  : int
4922  {
4923  global $DIC;
4924  $ilDB = $DIC['ilDB'];
4925 
4926  if (is_null($pass)) {
4927  $pass = 0;
4928  }
4929 
4930  $query = "
4931  SELECT tst_pass_result.tstamp pass_res_tstamp,
4932  tst_test_result.tstamp quest_res_tstamp
4933 
4934  FROM tst_pass_result
4935 
4936  LEFT JOIN tst_test_result
4937  ON tst_test_result.active_fi = tst_pass_result.active_fi
4938  AND tst_test_result.pass = tst_pass_result.pass
4939 
4940  WHERE tst_pass_result.active_fi = %s
4941  AND tst_pass_result.pass = %s
4942 
4943  ORDER BY tst_test_result.tstamp DESC
4944  ";
4945 
4946  $result = $ilDB->queryF(
4947  $query,
4948  ['integer', 'integer'],
4949  [$active_id, $pass]
4950  );
4951 
4952  while ($row = $ilDB->fetchAssoc($result)) {
4953  if ($row['quest_res_tstamp']) {
4954  return $row['quest_res_tstamp'];
4955  }
4956 
4957  return $row['pass_res_tstamp'];
4958  }
4959 
4960  return 0;
4961  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupQuestionSetTypeByActiveId()

ilObjTest::lookupQuestionSetTypeByActiveId ( int  $active_id)

Definition at line 5579 of file class.ilObjTest.php.

References $res, and null.

Referenced by getQuestionCountAndPointsForPassOfParticipant().

5579  : ?string
5580  {
5581  $query = "
5582  SELECT tst_tests.question_set_type
5583  FROM tst_active
5584  INNER JOIN tst_tests
5585  ON tst_active.test_fi = tst_tests.test_id
5586  WHERE tst_active.active_id = %s
5587  ";
5588 
5589  $res = $this->db->queryF($query, ['integer'], [$active_id]);
5590 
5591  while ($row = $this->db->fetchAssoc($res)) {
5592  return $row['question_set_type'];
5593  }
5594 
5595  return null;
5596  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ marksEditable()

ilObjTest::marksEditable ( )
Returns
{}

Definition at line 3998 of file class.ilObjTest.php.

References evalTotalPersons(), and getScoreSettings().

Referenced by ILIAS\Test\Scoring\Marks\MarkSchemaGUI\__construct().

3998  : bool
3999  {
4000  $total = $this->evalTotalPersons();
4001  $results_summary_settings = $this->getScoreSettings()->getResultSummarySettings();
4002  if ($total === 0
4003  || $results_summary_settings->getScoreReporting()->isReportingEnabled() === false) {
4004  return true;
4005  }
4006 
4007  if ($results_summary_settings->getScoreReporting() === ScoreReportingTypes::SCORE_REPORTING_DATE) {
4008  return $results_summary_settings->getReportingDate()
4009  >= new DateTimeImmutable('now', new DateTimeZone('UTC'));
4010  }
4011 
4012  return false;
4013  }
evalTotalPersons()
Returns the number of persons who started the test.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

ilObjTest::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

Returns the installation id for a given identifier.

private

Definition at line 3866 of file class.ilObjTest.php.

References ilUtil\insertInstIntoID().

3867  {
3868  if ($a_tag == "Identifier" && $a_param == "Entry") {
3869  $a_value = ilUtil::insertInstIntoID($a_value);
3870  }
3871 
3872  return $a_value;
3873  }
static insertInstIntoID(string $a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ moveQuestions()

ilObjTest::moveQuestions ( array  $move_questions,
int  $target_index,
int  $insert_mode 
)
Parameters
array<int>$move_questions
integer$insert_mode0, if insert before the target position, 1 if insert after the target position

Definition at line 2728 of file class.ilObjTest.php.

References $questions, ilObject\getRefId(), ILIAS\Repository\logger(), saveQuestionsToDb(), and ILIAS\Repository\user().

2728  : void
2729  {
2730  $this->questions = array_values($this->questions);
2731  $array_pos = array_search($target_index, $this->questions);
2732  if ($insert_mode == 0) {
2733  $part1 = array_slice($this->questions, 0, $array_pos);
2734  $part2 = array_slice($this->questions, $array_pos);
2735  } elseif ($insert_mode == 1) {
2736  $part1 = array_slice($this->questions, 0, $array_pos + 1);
2737  $part2 = array_slice($this->questions, $array_pos + 1);
2738  }
2739  foreach ($move_questions as $question_id) {
2740  if (!(array_search($question_id, $part1) === false)) {
2741  unset($part1[array_search($question_id, $part1)]);
2742  }
2743  if (!(array_search($question_id, $part2) === false)) {
2744  unset($part2[array_search($question_id, $part2)]);
2745  }
2746  }
2747  $part1 = array_values($part1);
2748  $part2 = array_values($part2);
2749  $new_array = array_values(array_merge($part1, $move_questions, $part2));
2750  $this->questions = [];
2751  $counter = 1;
2752  foreach ($new_array as $question_id) {
2753  $this->questions[$counter] = $question_id;
2754  $counter++;
2755  }
2756  $this->saveQuestionsToDb();
2757 
2758  if ($this->logger->isLoggingEnabled()) {
2759  $this->logger->logTestAdministrationInteraction(
2760  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
2761  $this->getRefId(),
2762  $this->user->getId(),
2763  TestAdministrationInteractionTypes::QUESTION_MOVED,
2764  [
2765  AdditionalInformationGenerator::KEY_QUESTION_ORDER => $this->questions
2766  ]
2767  )
2768  );
2769  }
2770  }
array $questions
+ Here is the call graph for this function:

◆ onMarkSchemaSaved()

ilObjTest::onMarkSchemaSaved ( )

Definition at line 3986 of file class.ilObjTest.php.

References participantDataExist(), recalculateScores(), and saveCompleteStatus().

3986  : void
3987  {
3988  $this->saveCompleteStatus($this->question_set_config_factory->getQuestionSetConfig());
3989 
3990  if ($this->participantDataExist()) {
3991  $this->recalculateScores(true);
3992  }
3993  }
saveCompleteStatus(ilTestQuestionSetConfig $test_question_set_config)
recalculateScores($preserve_manscoring=false)
+ Here is the call graph for this function:

◆ participantDataExist()

ilObjTest::participantDataExist ( )

Definition at line 7072 of file class.ilObjTest.php.

References $participantDataExist, evalTotalPersons(), and null.

Referenced by onMarkSchemaSaved().

7072  : bool
7073  {
7074  if ($this->participantDataExist === null) {
7075  $this->participantDataExist = (bool) $this->evalTotalPersons();
7076  }
7077 
7079  }
$participantDataExist
holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilO...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
evalTotalPersons()
Returns the number of persons who started the test.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pcArrayShuffle()

ilObjTest::pcArrayShuffle (   $array)

Shuffles the values of a given array.

Parameters
array$arrayAn array which should be shuffled public

Definition at line 1771 of file class.ilObjTest.php.

1771  : array
1772  {
1773  $keys = array_keys($array);
1774  shuffle($keys);
1775  $result = [];
1776  foreach ($keys as $key) {
1777  $result[$key] = $array[$key];
1778  }
1779  return $result;
1780  }

◆ prepareTextareaOutput()

ilObjTest::prepareTextareaOutput (   $txt_output,
  $prepare_for_latex_output = false,
  $omitNl2BrWhenTextArea = 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 5530 of file class.ilObjTest.php.

References null, and ilLegacyFormElementsUtil\prepareTextareaOutput().

5531  {
5532  if ($txt_output == null) {
5533  $txt_output = '';
5534  }
5536  $txt_output,
5537  $prepare_for_latex_output,
5538  $omitNl2BrWhenTextArea
5539  );
5540  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=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:

◆ processPrintoutput2FO()

ilObjTest::processPrintoutput2FO (   $print_output)

Convert a print output to XSL-FO.

Parameters
string$print_outputThe print output
Returns
string XSL-FO code public

Definition at line 5967 of file class.ilObjTest.php.

References $params, null, and ILIAS\Repository\settings().

Referenced by deliverPDFfromHTML().

5967  : string
5968  {
5969  if (extension_loaded("tidy")) {
5970  $config = [
5971  "indent" => false,
5972  "output-xml" => true,
5973  "numeric-entities" => true
5974  ];
5975  $tidy = new tidy();
5976  $tidy->parseString($print_output, $config, 'utf8');
5977  $tidy->cleanRepair();
5978  $print_output = tidy_get_output($tidy);
5979  $print_output = preg_replace("/^.*?(<html)/", "\\1", $print_output);
5980  } else {
5981  $print_output = str_replace("&nbsp;", "&#160;", $print_output);
5982  $print_output = str_replace("&otimes;", "X", $print_output);
5983  }
5984  $xsl = file_get_contents("./components/ILIAS/Test/xml/question2fo.xsl");
5985 
5986  // additional font support
5987 
5988  $xsl = str_replace(
5989  'font-family="Helvetica, unifont"',
5990  'font-family="' . $this->settings->get('rpc_pdf_font', 'Helvetica, unifont') . '"',
5991  $xsl
5992  );
5993 
5994  $args = [ '/_xml' => $print_output, '/_xsl' => $xsl ];
5995  $xh = xslt_create();
5996  $params = [];
5997  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
5998  xslt_error($xh);
5999  xslt_free($xh);
6000  return $output;
6001  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qtiMaterialToArray()

ilObjTest::qtiMaterialToArray (   $a_material)

Reads an QTI material tag and creates a text string.

Returns
string text or xhtml string public

Definition at line 5448 of file class.ilObjTest.php.

References ilSession\get(), and ILIAS\Repository\logger().

Referenced by fromXML().

5448  : array
5449  {
5450  $result = '';
5451  $mobs = [];
5452  for ($i = 0; $i < $a_material->getMaterialCount(); $i++) {
5453  $material = $a_material->getMaterial($i);
5454  if ($material['type'] === 'mattext') {
5455  $result .= $material['material']->getContent();
5456  }
5457  if ($material['type'] === 'matimage') {
5458  $matimage = $material['material'];
5459  if (preg_match('/(il_([0-9]+)_mob_([0-9]+))/', $matimage->getLabel(), $matches)) {
5460  $mobs[] = [
5461  'mob' => $matimage->getLabel(),
5462  'uri' => $matimage->getUri()
5463  ];
5464  }
5465  }
5466  }
5467 
5468  $decoded_result = base64_decode($result);
5469  if (str_starts_with($decoded_result, '<PageObject>')) {
5470  $result = $decoded_result;
5471  }
5472 
5473  $this->logger->info(print_r(ilSession::get('import_mob_xhtml'), true));
5474  return [
5475  'text' => $result,
5476  'mobs' => $mobs
5477  ];
5478  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ questionMoveDown()

ilObjTest::questionMoveDown (   $question_id)

Moves a question down in order.

Parameters
integer$question_idThe database id of the question to be moved down public
See also
$test_id

Definition at line 1313 of file class.ilObjTest.php.

References getTestId(), and loadQuestions().

1314  {
1315  $current_question_result = $this->db->queryF(
1316  "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
1317  ['integer','integer'],
1318  [$this->getTestId(), $question_id]
1319  );
1320  $current_question_data = $this->db->fetchObject($current_question_result);
1321  $next_question_result = $this->db->queryF(
1322  "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
1323  ['integer','integer'],
1324  [$this->getTestId(), $current_question_data->sequence + 1]
1325  );
1326  if ($this->db->numRows($next_question_result) === 1) {
1327  // OK, it's not the last question, so move it down
1328  $next_question_data = $this->db->fetchObject($next_question_result);
1329  // change next dataset
1330  $this->db->manipulateF(
1331  "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
1332  ['integer','integer'],
1333  [$current_question_data->sequence, $next_question_data->test_question_id]
1334  );
1335  // move actual dataset down
1336  $this->db->manipulateF(
1337  "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
1338  ['integer','integer'],
1339  [$current_question_data->sequence + 1, $current_question_data->test_question_id]
1340  );
1341  }
1342  $this->loadQuestions();
1343  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ questionMoveUp()

ilObjTest::questionMoveUp (   $question_id)

Moves a question up in order.

Parameters
integer$question_idThe database id of the question to be moved up public
See also
$test_id

Definition at line 1273 of file class.ilObjTest.php.

References $data, getTestId(), and loadQuestions().

1274  {
1275  // Move a question up in sequence
1276  $result = $this->db->queryF(
1277  "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
1278  ['integer', 'integer'],
1279  [$this->getTestId(), $question_id]
1280  );
1281  $data = $this->db->fetchObject($result);
1282  if ($data->sequence > 1) {
1283  // OK, it's not the top question, so move it up
1284  $result = $this->db->queryF(
1285  "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
1286  ['integer','integer'],
1287  [$this->getTestId(), $data->sequence - 1]
1288  );
1289  $data_previous = $this->db->fetchObject($result);
1290  // change previous dataset
1291  $this->db->manipulateF(
1292  "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
1293  ['integer','integer'],
1294  [$data->sequence, $data_previous->test_question_id]
1295  );
1296  // move actual dataset up
1297  $this->db->manipulateF(
1298  "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
1299  ['integer','integer'],
1300  [$data->sequence - 1, $data->test_question_id]
1301  );
1302  }
1303  $this->loadQuestions();
1304  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:

◆ read()

ilObjTest::read ( )

Definition at line 257 of file class.ilObjTest.php.

References loadFromDb(), and null.

257  : void
258  {
259  parent::read();
260  $this->main_settings = null;
261  $this->score_settings = null;
262  $this->mark_schema = null;
263  $this->loadFromDb();
264  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ recalculateScores()

ilObjTest::recalculateScores (   $preserve_manscoring = false)

Definition at line 7081 of file class.ilObjTest.php.

References ilLPStatusWrapper\_updateStatus(), ilObject\getId(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by onMarkSchemaSaved().

7082  {
7083  $scoring = new TestScoring($this, $this->user, $this->db, $this->lng);
7084  $scoring->setPreserveManualScores($preserve_manscoring);
7085  $scoring->recalculateSolutions();
7086  ilLPStatusWrapper::_updateStatus($this->getId(), $this->user->getId());
7087  }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reindexFixedQuestionOrdering()

ilObjTest::reindexFixedQuestionOrdering ( )

Definition at line 6581 of file class.ilObjTest.php.

References loadQuestions().

Referenced by removeQuestions(), and removeQuestionWithResults().

6582  {
6583  $question_set_config = $this->question_set_config_factory->getQuestionSetConfig();
6584  $reindexed_sequence_position_map = $question_set_config->reindexQuestionOrdering();
6585 
6586  $this->loadQuestions();
6587 
6588  return $reindexed_sequence_position_map;
6589  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestion()

ilObjTest::removeQuestion ( int  $question_id)

Definition at line 1104 of file class.ilObjTest.php.

References Vendor\Package\$e, ilObject\getRefId(), ILIAS\Repository\logger(), and ILIAS\Repository\user().

Referenced by removeQuestions(), and removeQuestionWithResults().

1104  : void
1105  {
1106  try {
1107  $question = self::_instanciateQuestion($question_id);
1108  $question_title = $question->getTitleForHTMLOutput();
1109  $question->delete($question_id);
1110  if ($this->logger->isLoggingEnabled()) {
1111  $this->logger->logTestAdministrationInteraction(
1112  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
1113  $this->getRefId(),
1114  $this->user->getId(),
1115  TestAdministrationInteractionTypes::QUESTION_REMOVED,
1116  [
1117  AdditionalInformationGenerator::KEY_QUESTION_TITLE => $question_title
1118  ]
1119  )
1120  );
1121  }
1122  } catch (InvalidArgumentException $e) {
1123  $this->logger->error($e->getMessage());
1124  $this->logger->error($e->getTraceAsString());
1125  }
1126  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionFromSequences()

ilObjTest::removeQuestionFromSequences ( int  $question_id,
array  $active_ids,
ilTestReindexedSequencePositionMap  $reindexed_sequence_position_map 
)
Parameters
array<int>$active_ids

Definition at line 1067 of file class.ilObjTest.php.

References $test_sequence.

Referenced by removeQuestionWithResults().

1071  : void {
1072  $test_sequence_factory = new ilTestSequenceFactory(
1073  $this,
1074  $this->db,
1075  $this->questionrepository
1076  );
1077 
1078  foreach ($active_ids as $active_id) {
1079  $passSelector = new ilTestPassesSelector($this->db, $this);
1080  $passSelector->setActiveId($active_id);
1081 
1082  foreach ($passSelector->getExistingPasses() as $pass) {
1083  $test_sequence = $test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
1084  $test_sequence->loadFromDb();
1085 
1086  $test_sequence->removeQuestion($question_id, $reindexed_sequence_position_map);
1087  $test_sequence->saveToDb();
1088  }
1089  }
1090  }
$test_sequence
contains the test sequence data
+ Here is the caller graph for this function:

◆ removeQuestions()

ilObjTest::removeQuestions ( array  $question_ids)
Parameters
array<int>$question_ids

Definition at line 1095 of file class.ilObjTest.php.

References reindexFixedQuestionOrdering(), and removeQuestion().

1095  : void
1096  {
1097  foreach ($question_ids as $question_id) {
1098  $this->removeQuestion((int) $question_id);
1099  }
1100 
1102  }
removeQuestion(int $question_id)
reindexFixedQuestionOrdering()
+ Here is the call graph for this function:

◆ removeQuestionsWithResults()

ilObjTest::removeQuestionsWithResults ( array  $question_ids)

Definition at line 1002 of file class.ilObjTest.php.

References ILIAS\Repository\lng(), removeQuestionWithResults(), and ILIAS\Repository\user().

1002  : void
1003  {
1004  $scoring = new TestScoring(
1005  $this,
1006  $this->user,
1007  $this->db,
1008  $this->lng
1009  );
1010 
1011  array_walk(
1012  $question_ids,
1013  fn(int $v, int $k) => $this->removeQuestionWithResults($v, $scoring)
1014  );
1015  }
removeQuestionWithResults(int $question_id, TestScoring $scoring)
+ Here is the call graph for this function:

◆ removeQuestionWithResults()

ilObjTest::removeQuestionWithResults ( int  $question_id,
TestScoring  $scoring 
)
private

Definition at line 1017 of file class.ilObjTest.php.

References ilObject\$object_properties, ilLPStatusWrapper\_refreshStatus(), ilObject\getId(), ilObject\getObjectProperties(), ilObjectProperties\getPropertyIsOnline(), ilObject\getRefId(), getTestQuestions(), assQuestion\instantiateQuestion(), isRandomTest(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), reindexFixedQuestionOrdering(), ILIAS\Test\Scoring\Manual\TestScoring\removeAllQuestionResults(), removeQuestion(), removeQuestionFromSequences(), ilObjectProperties\storePropertyIsOnline(), ILIAS\Test\Scoring\Manual\TestScoring\updatePassAndTestResults(), and ILIAS\Repository\user().

Referenced by removeQuestionsWithResults().

1017  : void
1018  {
1019  $question = \assQuestion::instantiateQuestion($question_id);
1020 
1021  $participant_data = new ilTestParticipantData($this->db, $this->lng);
1022  $participant_data->load($this->test_id);
1023 
1024  $question->removeAllExistingSolutions();
1025  $scoring->removeAllQuestionResults($question_id);
1026 
1027  $this->removeQuestion($question_id);
1028  if (!$this->isRandomTest()) {
1030  $question_id,
1031  $participant_data->getActiveIds(),
1033  );
1034  }
1035 
1036  $scoring->updatePassAndTestResults($participant_data->getActiveIds());
1037  ilLPStatusWrapper::_refreshStatus($this->getId(), $participant_data->getUserIds());
1038  $question->delete($question_id);
1039 
1040  if ($this->getTestQuestions() === []) {
1043  $object_properties->getPropertyIsOnline()->withOffline()
1044  );
1045  }
1046 
1047  if ($this->logger->isLoggingEnabled()) {
1048  $this->logger->logTestAdministrationInteraction(
1049  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
1050  $this->getRefId(),
1051  $this->user->getId(),
1052  TestAdministrationInteractionTypes::QUESTION_REMOVED_IN_CORRECTIONS,
1053  [
1054  AdditionalInformationGenerator::KEY_QUESTION_TITLE => $question->getTitleForHTMLOutput(),
1055  AdditionalInformationGenerator::KEY_QUESTION_TEXT => $question->getQuestion(),
1056  AdditionalInformationGenerator::KEY_QUESTION_ID => $question->getId(),
1057  AdditionalInformationGenerator::KEY_QUESTION_TYPE => $question->getQuestionType()
1058  ]
1059  )
1060  );
1061  }
1062  }
storePropertyIsOnline(ilObjectPropertyIsOnline $property_is_online)
isRandomTest()
Returns the fact wether this test is a random questions test or not.
static instantiateQuestion(int $question_id)
removeQuestion(int $question_id)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
updatePassAndTestResults(array $active_ids)
ilObjectProperties $object_properties
removeQuestionFromSequences(int $question_id, array $active_ids, ilTestReindexedSequencePositionMap $reindexed_sequence_position_map)
reindexFixedQuestionOrdering()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTestActives()

ilObjTest::removeTestActives ( array  $active_ids)
Parameters
array<int>$active_ids

Definition at line 1260 of file class.ilObjTest.php.

Referenced by removeTestResults(), removeTestResultsFromSoapLpAdministration(), and ilCourseObjectiveResult\resetTestForUser().

1260  : void
1261  {
1262  $IN_activeIds = $this->db->in('active_id', $active_ids, false, 'integer');
1263  $this->db->manipulate("DELETE FROM tst_active WHERE $IN_activeIds");
1264  }
+ Here is the caller graph for this function:

◆ removeTestResults()

ilObjTest::removeTestResults ( ilTestParticipantData  $participant_data)

Definition at line 1161 of file class.ilObjTest.php.

References ilTestParticipantData\getActiveIds(), ilTestParticipantData\getAnonymousActiveIds(), ilObject\getId(), ilObjectLP\getInstance(), ilObject\getRefId(), getTestId(), ilTestParticipantData\getUserIdByActiveId(), ilTestParticipantData\getUserIds(), ILIAS\Repository\logger(), removeTestActives(), removeTestResultsByActiveIds(), and ILIAS\Repository\user().

Referenced by deleteTest().

1161  : void
1162  {
1163  if ($participant_data->getAnonymousActiveIds() !== []) {
1164  $this->removeTestResultsByActiveIds($participant_data->getAnonymousActiveIds());
1165 
1166  $user_ids = array_map(
1167  static fn($active_id) => $participant_data->getUserIdByActiveId($active_id),
1168  $participant_data->getAnonymousActiveIds(),
1169  );
1170  $this->participant_repository->removeExtraTimeByUserId($this->getTestId(), $user_ids);
1171  }
1172 
1173  if ($participant_data->getUserIds() !== []) {
1174  /* @var ilTestLP $testLP */
1175  $test_lp = ilObjectLP::getInstance($this->getId());
1176  if ($test_lp instanceof ilTestLP) {
1177  $test_lp->setTestObject($this);
1178  $test_lp->resetLPDataForUserIds($participant_data->getUserIds(), false);
1179  }
1180 
1181  $this->participant_repository->removeExtraTimeByUserId($this->getTestId(), $participant_data->getUserIds());
1182  }
1183 
1184  if ($participant_data->getActiveIds() !== []) {
1185  $this->removeTestActives($participant_data->getActiveIds());
1186 
1187  $user_ids = array_map(
1188  static fn($active_id) => $participant_data->getUserIdByActiveId($active_id),
1189  $participant_data->getActiveIds(),
1190  );
1191  $this->participant_repository->removeExtraTimeByUserId($this->getTestId(), $user_ids);
1192  }
1193 
1194  if ($this->logger->isLoggingEnabled()) {
1195  $this->logger->logTestAdministrationInteraction(
1196  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
1197  $this->getRefId(),
1198  $this->user->getId(),
1199  TestAdministrationInteractionTypes::PARTICIPANT_DATA_REMOVED,
1200  [
1201  AdditionalInformationGenerator::KEY_USERS => $participant_data->getUserIds(),
1202  AdditionalInformationGenerator::KEY_ANON_IDS => $participant_data->getAnonymousActiveIds()
1203  ]
1204  )
1205  );
1206  }
1207  }
getTestId()
Gets the database id of the additional test data.
removeTestActives(array $active_ids)
removeTestResultsByActiveIds(array $active_ids)
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTestResultsByActiveIds()

ilObjTest::removeTestResultsByActiveIds ( array  $active_ids)
private

Definition at line 1227 of file class.ilObjTest.php.

References CLIENT_WEB_DIR, ilFileUtils\delDir(), ilAssQuestionHintTracking\deleteRequestsByActiveIds(), getTestId(), isRandomTest(), and PassPresentedVariablesRepo\TABLE_NAME.

Referenced by removeTestResults(), and removeTestResultsByUserIds().

1227  : void
1228  {
1229  $in_active_ids = $this->db->in('active_fi', $active_ids, false, 'integer');
1230 
1231  $this->db->manipulate("DELETE FROM tst_solutions WHERE {$in_active_ids}");
1232  $this->db->manipulate("DELETE FROM tst_qst_solved WHERE {$in_active_ids}");
1233  $this->db->manipulate("DELETE FROM tst_test_result WHERE {$in_active_ids}");
1234  $this->db->manipulate("DELETE FROM tst_pass_result WHERE {$in_active_ids}");
1235  $this->db->manipulate("DELETE FROM tst_result_cache WHERE {$in_active_ids}");
1236  $this->db->manipulate("DELETE FROM tst_sequence WHERE {$in_active_ids}");
1237  $this->db->manipulate("DELETE FROM tst_times WHERE {$in_active_ids}");
1238  $this->db->manipulate(
1240  . ' WHERE ' . $this->db->in('active_id', $active_ids, false, 'integer')
1241  );
1242 
1243  if ($this->isRandomTest()) {
1244  $this->db->manipulate("DELETE FROM tst_test_rnd_qst WHERE {$in_active_ids}");
1245  }
1246 
1247  foreach ($active_ids as $active_id) {
1248  // remove file uploads
1249  if (is_dir(CLIENT_WEB_DIR . "/assessment/tst_" . $this->getTestId() . "/$active_id")) {
1250  ilFileUtils::delDir(CLIENT_WEB_DIR . "/assessment/tst_" . $this->getTestId() . "/$active_id");
1251  }
1252  }
1253 
1255  }
getTestId()
Gets the database id of the additional test data.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const CLIENT_WEB_DIR
Definition: constants.php:47
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTestResultsByUserIds()

ilObjTest::removeTestResultsByUserIds ( array  $user_ids)

Definition at line 1209 of file class.ilObjTest.php.

References getTestId(), ILIAS\Repository\lng(), and removeTestResultsByActiveIds().

Referenced by removeTestResultsFromSoapLpAdministration().

1209  : void
1210  {
1211  $participantData = new ilTestParticipantData($this->db, $this->lng);
1212  $participantData->setUserIdsFilter($user_ids);
1213  $participantData->load($this->getTestId());
1214 
1215  $in_user_ids = $this->db->in('usr_id', $participantData->getUserIds(), false, 'integer');
1216  $this->db->manipulateF(
1217  "DELETE FROM usr_pref WHERE {$in_user_ids} AND keyword = %s",
1218  ['text'],
1219  ['tst_password_' . $this->getTestId()]
1220  );
1221 
1222  if ($participantData->getActiveIds() !== []) {
1223  $this->removeTestResultsByActiveIds($participantData->getActiveIds());
1224  }
1225  }
getTestId()
Gets the database id of the additional test data.
removeTestResultsByActiveIds(array $active_ids)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTestResultsFromSoapLpAdministration()

ilObjTest::removeTestResultsFromSoapLpAdministration ( array  $user_ids)

this method should only be used from non refactored soap context i think

Parameters
$userIds

Definition at line 1136 of file class.ilObjTest.php.

References ilObject\getRefId(), getTestId(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), removeTestActives(), removeTestResultsByUserIds(), and ILIAS\Repository\user().

1137  {
1138  $this->removeTestResultsByUserIds($user_ids);
1139 
1140  $participantData = new ilTestParticipantData($this->db, $this->lng);
1141  $participantData->setUserIdsFilter($user_ids);
1142  $participantData->load($this->getTestId());
1143 
1144  $this->removeTestActives($participantData->getActiveIds());
1145 
1146 
1147  if ($this->logger->isLoggingEnabled()) {
1148  $this->logger->logTestAdministrationInteraction(
1149  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
1150  $this->getRefId(),
1151  $this->user->getId(),
1152  TestAdministrationInteractionTypes::PARTICIPANT_DATA_REMOVED,
1153  [
1154  AdditionalInformationGenerator::KEY_USERS => $participantData->getUserIds()
1155  ]
1156  )
1157  );
1158  }
1159  }
getTestId()
Gets the database id of the additional test data.
removeTestResultsByUserIds(array $user_ids)
removeTestActives(array $active_ids)
+ Here is the call graph for this function:

◆ replaceFilesInPageImports()

ilObjTest::replaceFilesInPageImports ( string  $text,
array  $mappings 
)
private

Definition at line 3327 of file class.ilObjTest.php.

Referenced by addConcludingRemarksToSettingsFromImport(), and addIntroductionToSettingsFromImport().

3327  : string
3328  {
3329  preg_match_all('/il_(\d+)_file_(\d+)/', $text, $matches);
3330  foreach ($matches[0] as $index => $match) {
3331  if (empty($mappings[$matches[2][$index]])) {
3332  continue;
3333  }
3334  $text = str_replace($match, "il__file_{$mappings[$matches[2][$index]]}", $text);
3335  }
3336  return $text;
3337  }
+ Here is the caller graph for this function:

◆ replaceMobsInPageImports()

ilObjTest::replaceMobsInPageImports ( string  $text,
array  $mappings 
)
private

Definition at line 3314 of file class.ilObjTest.php.

References ilObjMediaObject\_saveUsage(), and ilObject\getId().

Referenced by addConcludingRemarksToSettingsFromImport(), and addIntroductionToSettingsFromImport().

3314  : string
3315  {
3316  preg_match_all('/il_(\d+)_mob_(\d+)/', $text, $matches);
3317  foreach ($matches[0] as $index => $match) {
3318  if (empty($mappings[$matches[2][$index]])) {
3319  continue;
3320  }
3321  $text = str_replace($match, "il__mob_{$mappings[$matches[2][$index]]}", $text);
3322  ilObjMediaObject::_saveUsage((int) $mappings[$matches[2][$index]], 'tst', $this->getId());
3323  }
3324  return $text;
3325  }
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveMobsFromLegacyImports()

ilObjTest::retrieveMobsFromLegacyImports ( string  $text,
array  $mobs,
string  $importdir 
)
private

Definition at line 3339 of file class.ilObjTest.php.

References ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilObjMediaObject\_saveUsage(), ilObject\getId(), and IL_INST_ID.

Referenced by addConcludingRemarksToSettingsFromImport(), and addIntroductionToSettingsFromImport().

3339  : string
3340  {
3341  foreach ($mobs as $mob) {
3342  $importfile = $importdir . DIRECTORY_SEPARATOR . $mob['uri'];
3343  if (file_exists($importfile)) {
3344  $media_object = ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, false);
3345  ilObjMediaObject::_saveUsage($media_object->getId(), 'tst:html', $this->getId());
3347  str_replace(
3348  'src="' . $mob['mob'] . '"',
3349  'src="' . 'il_' . IL_INST_ID . '_mob_' . $media_object->getId() . '"',
3350  $text
3351  ),
3352  1
3353  );
3354  }
3355  }
3356  return $text;
3357  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
const IL_INST_ID
Definition: constants.php:40
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
static _saveTempFileAsMediaObject(string $name, string $tmp_name, bool $upload=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAuthorToMetadata()

ilObjTest::saveAuthorToMetadata (   $author = "")

Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be called for conversion of "old" tests where the author hasn't been stored in the lifecycle metadata.

Parameters
string$a_authorA string containing the name of the test author private
See also
$author

Definition at line 4024 of file class.ilObjTest.php.

References ilObject\getId(), ilObject\getType(), and ILIAS\Repository\user().

Referenced by doCreateMetaData(), and fromXML().

4025  {
4026  $path_to_lifecycle = $this->lo_metadata->paths()->custom()->withNextStep('lifeCycle')->get();
4027  $path_to_authors = $this->lo_metadata->paths()->authors();
4028 
4029  $reader = $this->lo_metadata->read($this->getId(), 0, $this->getType(), $path_to_lifecycle);
4030  if (!is_null($reader->allData($path_to_lifecycle)->current())) {
4031  return;
4032  }
4033 
4034  if ($author === '') {
4035  $author = $this->user->getFullname();
4036  }
4037  $this->lo_metadata->manipulate($this->getId(), 0, $this->getType())
4038  ->prepareCreateOrUpdate($path_to_authors, $author)
4039  ->execute();
4040  }
string $author
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCompleteStatus()

ilObjTest::saveCompleteStatus ( ilTestQuestionSetConfig  $test_question_set_config)

Definition at line 439 of file class.ilObjTest.php.

References getTestId(), and isComplete().

Referenced by insertQuestion(), and onMarkSchemaSaved().

439  : void
440  {
441  $complete = 0;
442  if ($this->isComplete($test_question_set_config)) {
443  $complete = 1;
444  }
445  if ($this->getTestId() > 0) {
446  $this->db->manipulateF(
447  'UPDATE tst_tests SET complete = %s WHERE test_id = %s',
448  ['text', 'integer'],
449  [$complete, $this->test_id]
450  );
451  }
452  }
isComplete(ilTestQuestionSetConfig $test_question_set_config)
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveManualFeedback()

ilObjTest::saveManualFeedback ( int  $active_id,
int  $question_id,
int  $pass,
?string  $feedback,
bool  $finalized = false 
)

Definition at line 6148 of file class.ilObjTest.php.

References insertManualFeedback().

6154  : void {
6155  $feedback_old = self::getSingleManualFeedback($active_id, $question_id, $pass);
6156  $this->db->manipulateF(
6157  'DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s',
6158  ['integer', 'integer', 'integer'],
6159  [$active_id, $question_id, $pass]
6160  );
6161 
6162  $this->insertManualFeedback($active_id, $question_id, $pass, $feedback, $finalized, $feedback_old);
6163 
6164  }
insertManualFeedback(int $active_id, int $question_id, int $pass, ?string $feedback, bool $finalized, array $feedback_old)
+ Here is the call graph for this function:

◆ saveQuestionsToDb()

ilObjTest::saveQuestionsToDb ( )

Definition at line 539 of file class.ilObjTest.php.

References getTestId().

Referenced by moveQuestions(), and saveToDb().

539  : void
540  {
541  $this->db->manipulateF(
542  'DELETE FROM tst_test_question WHERE test_fi = %s',
543  ['integer'],
544  [$this->getTestId()]
545  );
546  foreach ($this->questions as $key => $value) {
547  $next_id = $this->db->nextId('tst_test_question');
548  $this->db->insert('tst_test_question', [
549  'test_question_id' => ['integer', $next_id],
550  'test_fi' => ['integer', $this->getTestId()],
551  'question_fi' => ['integer', $value],
552  'sequence' => ['integer', $key],
553  'tstamp' => ['integer', time()]
554  ]);
555  }
556  }
getTestId()
Gets the database id of the additional test data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

ilObjTest::saveToDb ( bool  $properties_only = false)

Definition at line 454 of file class.ilObjTest.php.

References evalTotalPersons(), getActivationEndingTime(), getActivationStartingTime(), getActivationVisibility(), ilObject\getId(), getMarkSchema(), getNrOfTries(), getQuestionSetType(), getTemplate(), getTestId(), isActivationLimited(), null, saveQuestionsToDb(), and storeActivationSettings().

Referenced by applyDefaults(), and fromXML().

454  : void
455  {
456  if ($this->test_id === -1) {
457  // Create new dataset
458  $next_id = $this->db->nextId('tst_tests');
459 
460  $this->db->insert(
461  'tst_tests',
462  [
463  'test_id' => ['integer', $next_id],
464  'obj_fi' => ['integer', $this->getId()],
465  'created' => ['integer', time()],
466  'tstamp' => ['integer', time()],
467  'template_id' => ['integer', $this->getTemplate()]
468  ]
469  );
470 
471  $this->test_id = $next_id;
472  } else {
473  if ($this->evalTotalPersons() > 0) {
474  // reset the finished status of participants if the nr of test passes did change
475  if ($this->getNrOfTries() > 0) {
476  // set all unfinished tests with nr of passes >= allowed passes finished
477  $aresult = $this->db->queryF(
478  "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
479  ['integer', 'integer', 'integer'],
480  [$this->getTestId(), $this->getNrOfTries(), 0]
481  );
482  while ($row = $this->db->fetchAssoc($aresult)) {
483  $this->db->manipulateF(
484  "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
485  ['integer', 'timestamp', 'integer'],
486  [1, date('Y-m-d H:i:s'), $row["active_id"]]
487  );
488  }
489 
490  // set all finished tests with nr of passes < allowed passes not finished
491  $aresult = $this->db->queryF(
492  "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
493  ['integer', 'integer', 'integer'],
494  [$this->getTestId(), $this->getNrOfTries() - 1, 1]
495  );
496  while ($row = $this->db->fetchAssoc($aresult)) {
497  $this->db->manipulateF(
498  "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
499  ['integer', 'timestamp', 'integer'],
500  [0, null, $row["active_id"]]
501  );
502  }
503  } else {
504  // set all finished tests with nr of passes >= allowed passes not finished
505  $aresult = $this->db->queryF(
506  "SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
507  ['integer', 'integer'],
508  [$this->getTestId(), 1]
509  );
510  while ($row = $this->db->fetchAssoc($aresult)) {
511  $this->db->manipulateF(
512  "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
513  ['integer', 'timestamp', 'integer'],
514  [0, null, $row["active_id"]]
515  );
516  }
517  }
518  }
519  }
520 
522  $this->isActivationLimited(),
523  $this->getActivationStartingTime(),
524  $this->getActivationEndingTime(),
525  $this->getActivationVisibility(),
526  );
527 
528  if ($properties_only) {
529  return;
530  }
531 
532  if ($this->getQuestionSetType() == self::QUESTION_SET_TYPE_FIXED) {
533  $this->saveQuestionsToDb();
534  }
535 
536  $this->marks_repository->storeMarkSchema($this->getMarkSchema());
537  }
getTestId()
Gets the database id of the additional test data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
evalTotalPersons()
Returns the number of persons who started the test.
storeActivationSettings(?bool $is_activation_limited=false, ?int $activation_starting_time=null, ?int $activation_ending_time=null, bool $activation_visibility=false,)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ secondsToHoursMinutesSecondsString()

ilObjTest::secondsToHoursMinutesSecondsString ( int  $seconds)
protected

Definition at line 6467 of file class.ilObjTest.php.

Referenced by getAggregatedResultsData().

6467  : string
6468  {
6469  $diff_hours = floor($seconds / 3600);
6470  $seconds -= $diff_hours * 3600;
6471  $diff_minutes = floor($seconds / 60);
6472  $seconds -= $diff_minutes * 60;
6473  return sprintf('%02d:%02d:%02d', $diff_hours, $diff_minutes, $seconds);
6474  }
+ Here is the caller graph for this function:

◆ sendAdvancedNotification()

ilObjTest::sendAdvancedNotification ( int  $active_id)

Definition at line 6498 of file class.ilObjTest.php.

References $path, _getUserIdFromActiveId(), ANONYMOUS_USER_ID, ilObject\getOwner(), ilObject\getTitle(), and userLookupFullName().

6498  : void
6499  {
6500  $mail = new ilTestMailNotification();
6501  $owner_id = $this->getOwner();
6502  $usr_data = $this->userLookupFullName(ilObjTest::_getUserIdFromActiveId($active_id));
6503 
6504  $path = $this->export_factory->getExporter(
6505  $this,
6506  ExportImportTypes::SCORED_ATTEMPT
6507  )->withFilterByActiveId($active_id)
6508  ->withResultsPage()
6509  ->withUserPages()
6510  ->write();
6511 
6512  $delivered_file_name = 'result_' . $active_id . '.xlsx';
6513  $fd = new ilFileDataMail(ANONYMOUS_USER_ID);
6514  $fd->copyAttachmentFile($path, $delivered_file_name);
6515  $file_names[] = $delivered_file_name;
6516 
6517  $mail->sendAdvancedNotification($owner_id, $this->getTitle(), $usr_data, $file_names);
6518 
6519  if (count($file_names)) {
6520  $fd->unlinkFiles($file_names);
6521  unset($fd);
6522  @unlink($path);
6523  }
6524  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
This class handles all operations on files (attachments) in directory ilias_data/mail.
Class ilTestMailNotification.
$path
Definition: ltiservices.php:29
static _getUserIdFromActiveId(int $active_id)
userLookupFullName($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
Returns the full name of a test user according to the anonymity status.
+ Here is the call graph for this function:

◆ sendSimpleNotification()

ilObjTest::sendSimpleNotification (   $active_id)

Definition at line 6490 of file class.ilObjTest.php.

References _getUserIdFromActiveId(), ilObject\getOwner(), ilObject\getTitle(), and userLookupFullName().

6491  {
6492  $mail = new ilTestMailNotification();
6493  $owner_id = $this->getOwner();
6494  $usr_data = $this->userLookupFullName(ilObjTest::_getUserIdFromActiveId($active_id));
6495  $mail->sendSimpleNotification($owner_id, $this->getTitle(), $usr_data);
6496  }
Class ilTestMailNotification.
static _getUserIdFromActiveId(int $active_id)
userLookupFullName($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
Returns the full name of a test user according to the anonymity status.
+ Here is the call graph for this function:

◆ setAccessFilteredParticipantList()

ilObjTest::setAccessFilteredParticipantList ( ilTestParticipantList  $access_filtered_participant_list)

Definition at line 2462 of file class.ilObjTest.php.

References $access_filtered_participant_list.

2462  : void
2463  {
2464  $this->access_filtered_participant_list = $access_filtered_participant_list;
2465  }
ilTestParticipantList $access_filtered_participant_list

◆ setActivationEndingTime()

ilObjTest::setActivationEndingTime ( ?int  $ending_time = null)

Definition at line 6907 of file class.ilObjTest.php.

Referenced by fromXML(), and loadFromDb().

6908  {
6909  $this->activation_ending_time = $ending_time;
6910  }
+ Here is the caller graph for this function:

◆ setActivationLimited()

ilObjTest::setActivationLimited (   $a_value)

Definition at line 6709 of file class.ilObjTest.php.

Referenced by fromXML(), loadFromDb(), and storeActivationSettings().

6710  {
6711  $this->activation_limited = (bool) $a_value;
6712  }
+ Here is the caller graph for this function:

◆ setActivationStartingTime()

ilObjTest::setActivationStartingTime ( ?int  $starting_time = null)

Definition at line 6902 of file class.ilObjTest.php.

Referenced by fromXML(), loadFromDb(), and storeActivationSettings().

6903  {
6904  $this->activation_starting_time = $starting_time;
6905  }
+ Here is the caller graph for this function:

◆ setActivationVisibility()

ilObjTest::setActivationVisibility (   $a_value)

Definition at line 6694 of file class.ilObjTest.php.

Referenced by fromXML(), loadFromDb(), and storeActivationSettings().

6695  {
6696  $this->activation_visibility = (bool) $a_value;
6697  }
+ Here is the caller graph for this function:

◆ setQuestionOrder()

ilObjTest::setQuestionOrder ( array  $order)

Definition at line 6591 of file class.ilObjTest.php.

References $id, ilObject\getRefId(), loadQuestions(), ILIAS\Repository\logger(), and ILIAS\Repository\user().

6592  {
6593  asort($order);
6594 
6595  $i = 0;
6596 
6597  foreach (array_keys($order) as $id) {
6598  $i++;
6599 
6600  $query = "
6601  UPDATE tst_test_question
6602  SET sequence = %s
6603  WHERE question_fi = %s
6604  ";
6605 
6606  $this->db->manipulateF(
6607  $query,
6608  ['integer', 'integer'],
6609  [$i, $id]
6610  );
6611  }
6612 
6613  if ($this->logger->isLoggingEnabled()) {
6614  $this->logger->logTestAdministrationInteraction(
6615  $this->logger->getInteractionFactory()->buildTestAdministrationInteraction(
6616  $this->getRefId(),
6617  $this->user->getId(),
6618  TestAdministrationInteractionTypes::QUESTION_MOVED,
6619  [
6620  AdditionalInformationGenerator::KEY_QUESTION_ORDER => $order
6621  ]
6622  )
6623  );
6624  }
6625 
6626  $this->loadQuestions();
6627  }
loadQuestions(int $active_id=0, ?int $pass=null)
Load the test question id&#39;s from the database.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setQuestionSetSolved()

ilObjTest::setQuestionSetSolved (   $value,
  $question_id,
  $user_id 
)

sets question solved state to value for given user_id

Definition at line 4639 of file class.ilObjTest.php.

References $user_id, and getActiveIdOfUser().

4640  {
4641  $active_id = $this->getActiveIdOfUser($user_id);
4642  $this->db->manipulateF(
4643  "DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
4644  ['integer', 'integer'],
4645  [$active_id, $question_id]
4646  );
4647  $this->db->manipulateF(
4648  "INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
4649  ['integer', 'integer', 'integer'],
4650  [$value, $question_id, $active_id]
4651  );
4652  }
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
+ Here is the call graph for this function:

◆ setQuestionSetType()

ilObjTest::setQuestionSetType ( string  $question_set_type)

Definition at line 7026 of file class.ilObjTest.php.

References getGeneralSettings(), and getMainSettings().

7027  {
7028  $this->main_settings = $this->getMainSettings()->withGeneralSettings(
7030  ->withQuestionSetType($question_set_type)
7031  );
7032  }
getGeneralSettings()
+ Here is the call graph for this function:

◆ setTemplate()

ilObjTest::setTemplate ( int  $template_id)

Definition at line 6571 of file class.ilObjTest.php.

References $template_id.

6572  {
6573  $this->template_id = $template_id;
6574  }

◆ setTestId()

ilObjTest::setTestId (   $a_id)

Sets the test ID.

Parameters
integer$a_idTest ID

Definition at line 6244 of file class.ilObjTest.php.

Referenced by loadFromDb().

6245  {
6246  $this->test_id = $a_id;
6247  }
+ Here is the caller graph for this function:

◆ setTmpCopyWizardCopyId()

ilObjTest::setTmpCopyWizardCopyId ( int  $tmpCopyWizardCopyId)

Definition at line 234 of file class.ilObjTest.php.

References $tmpCopyWizardCopyId.

234  : void
235  {
236  $this->tmpCopyWizardCopyId = $tmpCopyWizardCopyId;
237  }
int $tmpCopyWizardCopyId

◆ startingTimeReached()

ilObjTest::startingTimeReached ( )

Returns true if the starting time of a test is reached A starting time is not available for self assessment tests.

Returns
boolean true if the starting time is reached, otherwise false public

Definition at line 2780 of file class.ilObjTest.php.

References getStartingTime(), and isStartingTimeEnabled().

Referenced by isExecutable().

2780  : bool
2781  {
2782  if ($this->isStartingTimeEnabled() && $this->getStartingTime() != 0) {
2783  $now = time();
2784  if ($now < $this->getStartingTime()) {
2785  return false;
2786  }
2787  }
2788  return true;
2789  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startWorkingTime()

ilObjTest::startWorkingTime (   $active_id,
  $pass 
)

Write the initial entry for the tests working time to the database.

Parameters
integer$user_idThe database id of the user working with the test public

Definition at line 1585 of file class.ilObjTest.php.

1586  {
1587  $next_id = $this->db->nextId('tst_times');
1588  $affectedRows = $this->db->manipulateF(
1589  "INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
1590  ['integer', 'integer', 'timestamp', 'timestamp', 'integer', 'integer'],
1591  [$next_id, $active_id, date("Y-m-d H:i:s"), date("Y-m-d H:i:s"), $pass, time()]
1592  );
1593  return $next_id;
1594  }

◆ storeActivationSettings()

ilObjTest::storeActivationSettings ( ?bool  $is_activation_limited = false,
?int  $activation_starting_time = null,
?int  $activation_ending_time = null,
bool  $activation_visibility = false 
)

Definition at line 6714 of file class.ilObjTest.php.

References setActivationLimited(), setActivationStartingTime(), setActivationVisibility(), ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

Referenced by applyDefaults(), and saveToDb().

6719  : void {
6720  if (!$this->ref_id) {
6721  return;
6722  }
6723 
6724  $item = new ilObjectActivation();
6725  $is_activation_limited ??= false;
6726 
6727  if (!$is_activation_limited) {
6728  $item->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
6729  } else {
6730  $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
6731  $item->setTimingStart($activation_starting_time);
6732  $item->setTimingEnd($activation_ending_time);
6733  $item->toggleVisible($activation_visibility);
6734  }
6735 
6736  $item->update($this->ref_id);
6737 
6738  $this->setActivationLimited($is_activation_limited);
6742  }
int $activation_starting_time
setActivationStartingTime(?int $starting_time=null)
setActivationLimited($a_value)
setActivationVisibility($a_value)
int $activation_ending_time
bool $activation_visibility
Class ilObjectActivation.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeMarkSchema()

ilObjTest::storeMarkSchema ( MarkSchema  $mark_schema)

Definition at line 845 of file class.ilObjTest.php.

References null.

845  : void
846  {
847  $this->marks_repository->storeMarkSchema($mark_schema);
848  $this->mark_schema = null;
849  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ toXML()

ilObjTest::toXML ( )

Returns a QTI xml representation of the test.

Returns
string The QTI xml representation of the test

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

References $data, ilRTE\_replaceMediaObjectImageSrc(), addQTIMaterial(), buildIso8601PeriodForExportCompatibility(), ILIAS\Test\Settings\MainSettings\MainSettings\getAccessSettings(), getActivationEndingTime(), getActivationStartingTime(), getActivationVisibility(), ILIAS\Test\Settings\MainSettings\MainSettings\getAdditionalSettings(), getAuthor(), getCountSystem(), ilObject\getDescription(), getEndingTime(), getExportSettings(), getFinalStatement(), ILIAS\Test\Settings\MainSettings\MainSettings\getFinishingSettings(), ILIAS\Test\Settings\MainSettings\MainSettings\getGeneralSettings(), getHighscoreAchievedTS(), getHighscoreAnon(), getHighscoreEnabled(), getHighscoreHints(), getHighscoreOwnTable(), getHighscorePercentage(), getHighscoreScore(), getHighscoreTopNum(), getHighscoreTopTable(), getHighscoreWTime(), getInstantFeedbackSolution(), getIntroduction(), ILIAS\Test\Settings\MainSettings\MainSettings\getIntroductionSettings(), getMainSettings(), getMarkSchema(), ILIAS\Test\Settings\MainSettings\MainSettings\getParticipantFunctionalitySettings(), getPassScoring(), getProcessingTimeForXML(), ILIAS\Test\Settings\MainSettings\MainSettings\getQuestionBehaviourSettings(), getScoreCutting(), getScoreSettings(), getStartingTime(), ILIAS\Test\Settings\MainSettings\MainSettings\getTestBehaviourSettings(), getTestId(), ilObject\getTitle(), IL_INST_ID, ILIAS_VERSION, isActivationLimited(), isPassDeletionAllowed(), isShowGradingMarkEnabled(), isShowGradingStatusEnabled(), and null.

3364  : string
3365  {
3366  $main_settings = $this->getMainSettings();
3367  $a_xml_writer = new ilXmlWriter();
3368  // set xml header
3369  $a_xml_writer->xmlHeader();
3370  $a_xml_writer->xmlSetDtdDef("<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
3371  $a_xml_writer->xmlStartTag("questestinterop");
3372 
3373  $attrs = [
3374  "ident" => "il_" . IL_INST_ID . "_tst_" . $this->getTestId(),
3375  "title" => $this->getTitle()
3376  ];
3377  $a_xml_writer->xmlStartTag("assessment", $attrs);
3378  $a_xml_writer->xmlElement("qticomment", null, $this->getDescription());
3379 
3380  if ($main_settings->getTestBehaviourSettings()->getProcessingTimeEnabled()) {
3381  $a_xml_writer->xmlElement(
3382  "duration",
3383  null,
3384  $this->getProcessingTimeForXML()
3385  );
3386  }
3387 
3388  $a_xml_writer->xmlStartTag("qtimetadata");
3389  $a_xml_writer->xmlStartTag("qtimetadatafield");
3390  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
3391  $a_xml_writer->xmlElement("fieldentry", null, ILIAS_VERSION);
3392  $a_xml_writer->xmlEndTag("qtimetadatafield");
3393 
3394  $a_xml_writer->xmlStartTag("qtimetadatafield");
3395  $a_xml_writer->xmlElement("fieldlabel", null, "anonymity");
3396  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getGeneralSettings()->getAnonymity()));
3397  $a_xml_writer->xmlEndTag("qtimetadatafield");
3398 
3399  $a_xml_writer->xmlStartTag("qtimetadatafield");
3400  $a_xml_writer->xmlElement("fieldlabel", null, "question_set_type");
3401  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getGeneralSettings()->getQuestionSetType());
3402  $a_xml_writer->xmlEndTag("qtimetadatafield");
3403 
3404  $a_xml_writer->xmlStartTag("qtimetadatafield");
3405  $a_xml_writer->xmlElement("fieldlabel", null, "sequence_settings");
3406  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getParticipantFunctionalitySettings()->getPostponedQuestionsMoveToEnd());
3407  $a_xml_writer->xmlEndTag("qtimetadatafield");
3408 
3409  $a_xml_writer->xmlStartTag("qtimetadatafield");
3410  $a_xml_writer->xmlElement("fieldlabel", null, "author");
3411  $a_xml_writer->xmlElement("fieldentry", null, $this->getAuthor());
3412  $a_xml_writer->xmlEndTag("qtimetadatafield");
3413 
3414  $a_xml_writer->xmlStartTag("qtimetadatafield");
3415  $a_xml_writer->xmlElement("fieldlabel", null, "reset_processing_time");
3416  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getTestBehaviourSettings()->getResetProcessingTime());
3417  $a_xml_writer->xmlEndTag("qtimetadatafield");
3418 
3419  $a_xml_writer->xmlStartTag("qtimetadatafield");
3420  $a_xml_writer->xmlElement("fieldlabel", null, "count_system");
3421  $a_xml_writer->xmlElement("fieldentry", null, $this->getCountSystem());
3422  $a_xml_writer->xmlEndTag("qtimetadatafield");
3423 
3424  $a_xml_writer->xmlStartTag("qtimetadatafield");
3425  $a_xml_writer->xmlElement("fieldlabel", null, "score_cutting");
3426  $a_xml_writer->xmlElement("fieldentry", null, $this->getScoreCutting());
3427  $a_xml_writer->xmlEndTag("qtimetadatafield");
3428 
3429  $a_xml_writer->xmlStartTag("qtimetadatafield");
3430  $a_xml_writer->xmlElement("fieldlabel", null, "password");
3431  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getAccessSettings()->getPassword() ?? '');
3432  $a_xml_writer->xmlEndTag("qtimetadatafield");
3433 
3434  $a_xml_writer->xmlStartTag("qtimetadatafield");
3435  $a_xml_writer->xmlElement("fieldlabel", null, "ip_range_from");
3436  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getAccessSettings()->getIpRangeFrom());
3437  $a_xml_writer->xmlEndTag("qtimetadatafield");
3438 
3439  $a_xml_writer->xmlStartTag("qtimetadatafield");
3440  $a_xml_writer->xmlElement("fieldlabel", null, "ip_range_to");
3441  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getAccessSettings()->getIpRangeTo());
3442  $a_xml_writer->xmlEndTag("qtimetadatafield");
3443 
3444  $a_xml_writer->xmlStartTag("qtimetadatafield");
3445  $a_xml_writer->xmlElement("fieldlabel", null, "pass_scoring");
3446  $a_xml_writer->xmlElement("fieldentry", null, $this->getPassScoring());
3447  $a_xml_writer->xmlEndTag("qtimetadatafield");
3448 
3449  $a_xml_writer->xmlStartTag('qtimetadatafield');
3450  $a_xml_writer->xmlElement('fieldlabel', null, 'pass_deletion_allowed');
3451  $a_xml_writer->xmlElement('fieldentry', null, (int) $this->isPassDeletionAllowed());
3452  $a_xml_writer->xmlEndTag('qtimetadatafield');
3453 
3454  if ($this->getScoreSettings()->getResultSummarySettings()->getReportingDate() !== null) {
3455  $a_xml_writer->xmlStartTag("qtimetadatafield");
3456  $a_xml_writer->xmlElement("fieldlabel", null, "reporting_date");
3457  $a_xml_writer->xmlElement(
3458  "fieldentry",
3459  null,
3461  $this->getScoreSettings()->getResultSummarySettings()->getReportingDate(),
3462  ),
3463  );
3464  $a_xml_writer->xmlEndTag("qtimetadatafield");
3465  }
3466 
3467  $a_xml_writer->xmlStartTag("qtimetadatafield");
3468  $a_xml_writer->xmlElement("fieldlabel", null, "nr_of_tries");
3469  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getTestBehaviourSettings()->getNumberOfTries()));
3470  $a_xml_writer->xmlEndTag("qtimetadatafield");
3471 
3472  $a_xml_writer->xmlStartTag('qtimetadatafield');
3473  $a_xml_writer->xmlElement('fieldlabel', null, 'block_after_passed');
3474  $a_xml_writer->xmlElement('fieldentry', null, (int) $main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled());
3475  $a_xml_writer->xmlEndTag('qtimetadatafield');
3476 
3477  $a_xml_writer->xmlStartTag("qtimetadatafield");
3478  $a_xml_writer->xmlElement("fieldlabel", null, "pass_waiting");
3479  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getTestBehaviourSettings()->getPassWaiting());
3480  $a_xml_writer->xmlEndTag("qtimetadatafield");
3481 
3482  $a_xml_writer->xmlStartTag("qtimetadatafield");
3483  $a_xml_writer->xmlElement("fieldlabel", null, "kiosk");
3484  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getTestBehaviourSettings()->getKioskMode()));
3485  $a_xml_writer->xmlEndTag("qtimetadatafield");
3486 
3487  $a_xml_writer->xmlStartTag('qtimetadatafield');
3488  $a_xml_writer->xmlElement("fieldlabel", null, "redirection_mode");
3489  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getFinishingSettings()->getRedirectionMode());
3490  $a_xml_writer->xmlEndTag("qtimetadatafield");
3491 
3492  $a_xml_writer->xmlStartTag('qtimetadatafield');
3493  $a_xml_writer->xmlElement("fieldlabel", null, "redirection_url");
3494  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getFinishingSettings()->getRedirectionUrl());
3495  $a_xml_writer->xmlEndTag("qtimetadatafield");
3496 
3497  $a_xml_writer->xmlStartTag("qtimetadatafield");
3498  $a_xml_writer->xmlElement("fieldlabel", null, "use_previous_answers");
3499  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed());
3500  $a_xml_writer->xmlEndTag("qtimetadatafield");
3501 
3502  $a_xml_writer->xmlStartTag("qtimetadatafield");
3503  $a_xml_writer->xmlElement("fieldlabel", null, "title_output");
3504  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getQuestionBehaviourSettings()->getQuestionTitleOutputMode()));
3505  $a_xml_writer->xmlEndTag("qtimetadatafield");
3506 
3507  $a_xml_writer->xmlStartTag("qtimetadatafield");
3508  $a_xml_writer->xmlElement("fieldlabel", null, "results_presentation");
3509  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreSettings()->getResultDetailsSettings()->getResultsPresentation()));
3510  $a_xml_writer->xmlEndTag("qtimetadatafield");
3511 
3512  $a_xml_writer->xmlStartTag("qtimetadatafield");
3513  $a_xml_writer->xmlElement("fieldlabel", null, "examid_in_test_pass");
3514  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getTestBehaviourSettings()->getExamIdInTestAttemptEnabled()));
3515  $a_xml_writer->xmlEndTag("qtimetadatafield");
3516 
3517  $a_xml_writer->xmlStartTag("qtimetadatafield");
3518  $a_xml_writer->xmlElement("fieldlabel", null, "examid_in_test_res");
3519  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreSettings()->getResultDetailsSettings()->getShowExamIdInTestResults()));
3520  $a_xml_writer->xmlEndTag("qtimetadatafield");
3521 
3522  $a_xml_writer->xmlStartTag("qtimetadatafield");
3523  $a_xml_writer->xmlElement("fieldlabel", null, "usr_pass_overview_mode");
3524  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $main_settings->getParticipantFunctionalitySettings()->getUsrPassOverviewMode()));
3525  $a_xml_writer->xmlEndTag("qtimetadatafield");
3526 
3527  $a_xml_writer->xmlStartTag("qtimetadatafield");
3528  $a_xml_writer->xmlElement("fieldlabel", null, "score_reporting");
3529  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreSettings()->getResultSummarySettings()->getScoreReporting()->value));
3530  $a_xml_writer->xmlEndTag("qtimetadatafield");
3531 
3532  $a_xml_writer->xmlStartTag("qtimetadatafield");
3533  $a_xml_writer->xmlElement("fieldlabel", null, "show_solution_list_comparison");
3534  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->score_settings->getResultDetailsSettings()->getShowSolutionListComparison());
3535  $a_xml_writer->xmlEndTag("qtimetadatafield");
3536 
3537  $a_xml_writer->xmlStartTag("qtimetadatafield");
3538  $a_xml_writer->xmlElement("fieldlabel", null, "instant_verification");
3539  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackSolutionEnabled()));
3540  $a_xml_writer->xmlEndTag("qtimetadatafield");
3541 
3542  $a_xml_writer->xmlStartTag("qtimetadatafield");
3543  $a_xml_writer->xmlElement("fieldlabel", null, "answer_feedback");
3544  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackGenericEnabled()));
3545  $a_xml_writer->xmlEndTag("qtimetadatafield");
3546 
3547  $a_xml_writer->xmlStartTag("qtimetadatafield");
3548  $a_xml_writer->xmlElement("fieldlabel", null, "instant_feedback_specific");
3549  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackSpecificEnabled()));
3550  $a_xml_writer->xmlEndTag("qtimetadatafield");
3551 
3552  $a_xml_writer->xmlStartTag("qtimetadatafield");
3553  $a_xml_writer->xmlElement("fieldlabel", null, "answer_feedback_points");
3554  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackPointsEnabled()));
3555  $a_xml_writer->xmlEndTag("qtimetadatafield");
3556 
3557  $a_xml_writer->xmlStartTag("qtimetadatafield");
3558  $a_xml_writer->xmlElement("fieldlabel", null, "follow_qst_answer_fixation");
3559  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getLockAnswerOnNextQuestionEnabled());
3560  $a_xml_writer->xmlEndTag("qtimetadatafield");
3561 
3562  $a_xml_writer->xmlStartTag("qtimetadatafield");
3563  $a_xml_writer->xmlElement("fieldlabel", null, "instant_feedback_answer_fixation");
3564  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getLockAnswerOnInstantFeedbackEnabled());
3565  $a_xml_writer->xmlEndTag("qtimetadatafield");
3566 
3567  $a_xml_writer->xmlStartTag("qtimetadatafield");
3568  $a_xml_writer->xmlElement("fieldlabel", null, "force_instant_feedback");
3569  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getForceInstantFeedbackOnNextQuestion());
3570  $a_xml_writer->xmlEndTag("qtimetadatafield");
3571 
3572  $highscore_metadata = [
3573  'highscore_enabled' => ['value' => $this->getHighscoreEnabled()],
3574  'highscore_anon' => ['value' => $this->getHighscoreAnon()],
3575  'highscore_achieved_ts' => ['value' => $this->getHighscoreAchievedTS()],
3576  'highscore_score' => ['value' => $this->getHighscoreScore()],
3577  'highscore_percentage' => ['value' => $this->getHighscorePercentage()],
3578  'highscore_hints' => ['value' => $this->getHighscoreHints()],
3579  'highscore_wtime' => ['value' => $this->getHighscoreWTime()],
3580  'highscore_own_table' => ['value' => $this->getHighscoreOwnTable()],
3581  'highscore_top_table' => ['value' => $this->getHighscoreTopTable()],
3582  'highscore_top_num' => ['value' => $this->getHighscoreTopNum()],
3583  ];
3584  foreach ($highscore_metadata as $label => $data) {
3585  $a_xml_writer->xmlStartTag("qtimetadatafield");
3586  $a_xml_writer->xmlElement("fieldlabel", null, $label);
3587  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $data['value']));
3588  $a_xml_writer->xmlEndTag("qtimetadatafield");
3589  }
3590 
3591  $a_xml_writer->xmlStartTag("qtimetadatafield");
3592  $a_xml_writer->xmlElement("fieldlabel", null, "suspend_test_allowed");
3593  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getParticipantFunctionalitySettings()->getSuspendTestAllowed()));
3594  $a_xml_writer->xmlEndTag("qtimetadatafield");
3595 
3596  $a_xml_writer->xmlStartTag("qtimetadatafield");
3597  $a_xml_writer->xmlElement("fieldlabel", null, "show_marker");
3598  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getParticipantFunctionalitySettings()->getQuestionMarkingEnabled()));
3599  $a_xml_writer->xmlEndTag("qtimetadatafield");
3600 
3601  $a_xml_writer->xmlStartTag("qtimetadatafield");
3602  $a_xml_writer->xmlElement("fieldlabel", null, "fixed_participants");
3603  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getAccessSettings()->getFixedParticipants()));
3604  $a_xml_writer->xmlEndTag("qtimetadatafield");
3605 
3606  $a_xml_writer->xmlStartTag("qtimetadatafield");
3607  $a_xml_writer->xmlElement("fieldlabel", null, "show_introduction");
3608  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getIntroductionSettings()->getIntroductionEnabled()));
3609  $a_xml_writer->xmlEndTag("qtimetadatafield");
3610 
3611  $a_xml_writer->xmlStartTag("qtimetadatafield");
3612  $a_xml_writer->xmlElement("fieldlabel", null, "show_concluding_remarks");
3613  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getFinishingSettings()->getConcludingRemarksEnabled()));
3614  $a_xml_writer->xmlEndTag("qtimetadatafield");
3615 
3616  $a_xml_writer->xmlStartTag("qtimetadatafield");
3617  $a_xml_writer->xmlElement("fieldlabel", null, "mailnotification");
3618  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getFinishingSettings()->getMailNotificationContentType());
3619  $a_xml_writer->xmlEndTag("qtimetadatafield");
3620 
3621  $a_xml_writer->xmlStartTag("qtimetadatafield");
3622  $a_xml_writer->xmlElement("fieldlabel", null, "mailnottype");
3623  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getFinishingSettings()->getAlwaysSendMailNotification());
3624  $a_xml_writer->xmlEndTag("qtimetadatafield");
3625 
3626  $a_xml_writer->xmlStartTag("qtimetadatafield");
3627  $a_xml_writer->xmlElement("fieldlabel", null, "exportsettings");
3628  $a_xml_writer->xmlElement("fieldentry", null, $this->getExportSettings());
3629  $a_xml_writer->xmlEndTag("qtimetadatafield");
3630 
3631  $a_xml_writer->xmlStartTag("qtimetadatafield");
3632  $a_xml_writer->xmlElement("fieldlabel", null, "shuffle_questions");
3633  $a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", (int) $main_settings->getQuestionBehaviourSettings()->getShuffleQuestions()));
3634  $a_xml_writer->xmlEndTag("qtimetadatafield");
3635 
3636  $a_xml_writer->xmlStartTag("qtimetadatafield");
3637  $a_xml_writer->xmlElement("fieldlabel", null, "processing_time");
3638  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getTestBehaviourSettings()->getProcessingTime());
3639  $a_xml_writer->xmlEndTag("qtimetadatafield");
3640 
3641  $a_xml_writer->xmlStartTag("qtimetadatafield");
3642  $a_xml_writer->xmlElement("fieldlabel", null, "enable_examview");
3643  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getFinishingSettings()->getShowAnswerOverview());
3644  $a_xml_writer->xmlEndTag("qtimetadatafield");
3645 
3646  $a_xml_writer->xmlStartTag("qtimetadatafield");
3647  $a_xml_writer->xmlElement("fieldlabel", null, "skill_service");
3648  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getAdditionalSettings()->getSkillsServiceEnabled());
3649  $a_xml_writer->xmlEndTag("qtimetadatafield");
3650 
3651  if ($this->getInstantFeedbackSolution() == 1) {
3652  $attrs = [
3653  "solutionswitch" => "Yes"
3654  ];
3655  } else {
3656  $attrs = null;
3657  }
3658  $a_xml_writer->xmlElement("assessmentcontrol", $attrs, null);
3659 
3660  $a_xml_writer->xmlStartTag("qtimetadatafield");
3661  $a_xml_writer->xmlElement("fieldlabel", null, "show_grading_status");
3662  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->isShowGradingStatusEnabled());
3663  $a_xml_writer->xmlEndTag("qtimetadatafield");
3664 
3665  $a_xml_writer->xmlStartTag("qtimetadatafield");
3666  $a_xml_writer->xmlElement("fieldlabel", null, "show_grading_mark");
3667  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->isShowGradingMarkEnabled());
3668  $a_xml_writer->xmlEndTag("qtimetadatafield");
3669 
3670  if ($this->getStartingTime() > 0) {
3671  $a_xml_writer->xmlStartTag("qtimetadatafield");
3672  $a_xml_writer->xmlElement("fieldlabel", null, "starting_time");
3673  $a_xml_writer->xmlElement(
3674  "fieldentry",
3675  null,
3677  (new DateTimeImmutable())->setTimestamp($this->getStartingTime()),
3678  ),
3679  );
3680  $a_xml_writer->xmlEndTag("qtimetadatafield");
3681  }
3682 
3683  if ($this->getEndingTime() > 0) {
3684  $a_xml_writer->xmlStartTag("qtimetadatafield");
3685  $a_xml_writer->xmlElement("fieldlabel", null, "ending_time");
3686  $a_xml_writer->xmlElement(
3687  "fieldentry",
3688  null,
3690  (new DateTimeImmutable())->setTimestamp($this->getEndingTime()),
3691  ),
3692  );
3693  $a_xml_writer->xmlEndTag("qtimetadatafield");
3694  }
3695 
3696  $a_xml_writer->xmlStartTag("qtimetadatafield");
3697  $a_xml_writer->xmlElement("fieldlabel", null, "activation_limited");
3698  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->isActivationLimited());
3699  $a_xml_writer->xmlEndTag("qtimetadatafield");
3700 
3701  $a_xml_writer->xmlStartTag("qtimetadatafield");
3702  $a_xml_writer->xmlElement("fieldlabel", null, "activation_start_time");
3703  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->getActivationStartingTime());
3704  $a_xml_writer->xmlEndTag("qtimetadatafield");
3705 
3706  $a_xml_writer->xmlStartTag("qtimetadatafield");
3707  $a_xml_writer->xmlElement("fieldlabel", null, "activation_end_time");
3708  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->getActivationEndingTime());
3709  $a_xml_writer->xmlEndTag("qtimetadatafield");
3710 
3711  $a_xml_writer->xmlStartTag("qtimetadatafield");
3712  $a_xml_writer->xmlElement("fieldlabel", null, "activation_visibility");
3713  $a_xml_writer->xmlElement("fieldentry", null, (int) $this->getActivationVisibility());
3714  $a_xml_writer->xmlEndTag("qtimetadatafield");
3715 
3716  $a_xml_writer->xmlStartTag("qtimetadatafield");
3717  $a_xml_writer->xmlElement("fieldlabel", null, "autosave");
3718  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getAutosaveEnabled());
3719  $a_xml_writer->xmlEndTag("qtimetadatafield");
3720 
3721  $a_xml_writer->xmlStartTag("qtimetadatafield");
3722  $a_xml_writer->xmlElement("fieldlabel", null, "autosave_ival");
3723  $a_xml_writer->xmlElement("fieldentry", null, $main_settings->getQuestionBehaviourSettings()->getAutosaveInterval());
3724  $a_xml_writer->xmlEndTag("qtimetadatafield");
3725 
3726  $a_xml_writer->xmlStartTag("qtimetadatafield");
3727  $a_xml_writer->xmlElement("fieldlabel", null, "offer_question_hints");
3728  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getQuestionHintsEnabled());
3729  $a_xml_writer->xmlEndTag("qtimetadatafield");
3730 
3731  $a_xml_writer->xmlStartTag("qtimetadatafield");
3732  $a_xml_writer->xmlElement("fieldlabel", null, "instant_feedback_specific");
3733  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getInstantFeedbackSpecificEnabled());
3734  $a_xml_writer->xmlEndTag("qtimetadatafield");
3735 
3736  $a_xml_writer->xmlStartTag("qtimetadatafield");
3737  $a_xml_writer->xmlElement("fieldlabel", null, "instant_feedback_answer_fixation");
3738  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getQuestionBehaviourSettings()->getLockAnswerOnInstantFeedbackEnabled());
3739  $a_xml_writer->xmlEndTag("qtimetadatafield");
3740 
3741  $a_xml_writer->xmlStartTag("qtimetadatafield");
3742  $a_xml_writer->xmlElement("fieldlabel", null, "enable_processing_time");
3743  $a_xml_writer->xmlElement("fieldentry", null, (int) $main_settings->getTestBehaviourSettings()->getProcessingTimeEnabled());
3744  $a_xml_writer->xmlEndTag("qtimetadatafield");
3745 
3746  foreach ($this->getMarkSchema()->getMarkSteps() as $index => $mark) {
3747  $a_xml_writer->xmlStartTag("qtimetadatafield");
3748  $a_xml_writer->xmlElement("fieldlabel", null, "mark_step_$index");
3749  $a_xml_writer->xmlElement("fieldentry", null, sprintf(
3750  "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
3751  $mark->getShortName(),
3752  $mark->getOfficialName(),
3753  $mark->getMinimumLevel(),
3754  $mark->getPassed()
3755  ));
3756  $a_xml_writer->xmlEndTag("qtimetadatafield");
3757  }
3758  $a_xml_writer->xmlEndTag("qtimetadata");
3759 
3760  $page_id = $main_settings->getIntroductionSettings()->getIntroductionPageId();
3761  $introduction = $page_id !== null
3762  ? (new ilTestPage($page_id))->getXMLContent()
3763  : ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 0);
3764 
3765  $a_xml_writer->xmlStartTag("objectives");
3766  $this->addQTIMaterial($a_xml_writer, $page_id, $introduction);
3767  $a_xml_writer->xmlEndTag("objectives");
3768 
3769  if ($this->getInstantFeedbackSolution() == 1) {
3770  $attrs = [
3771  "solutionswitch" => "Yes"
3772  ];
3773  } else {
3774  $attrs = null;
3775  }
3776  $a_xml_writer->xmlElement("assessmentcontrol", $attrs, null);
3777 
3778  if (strlen($this->getFinalStatement())) {
3779  $page_id = $main_settings->getFinishingSettings()->getConcludingRemarksPageId();
3780  $concluding_remarks = $page_id !== null
3781  ? (new ilTestPage($page_id))->getXMLContent()
3782  : ilRTE::_replaceMediaObjectImageSrc($this->getFinalStatement());
3783  // add qti presentation_material
3784  $a_xml_writer->xmlStartTag("presentation_material");
3785  $a_xml_writer->xmlStartTag("flow_mat");
3786  $this->addQTIMaterial($a_xml_writer, $page_id, $concluding_remarks);
3787  $a_xml_writer->xmlEndTag("flow_mat");
3788  $a_xml_writer->xmlEndTag("presentation_material");
3789  }
3790 
3791  $attrs = [
3792  "ident" => "1"
3793  ];
3794  $a_xml_writer->xmlElement("section", $attrs, null);
3795  $a_xml_writer->xmlEndTag("assessment");
3796  $a_xml_writer->xmlEndTag("questestinterop");
3797 
3798  $xml = $a_xml_writer->xmlDumpMem(false);
3799  return $xml;
3800  }
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
getHighscoreTopNum(int $a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
const IL_INST_ID
Definition: constants.php:40
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
getTestId()
Gets the database id of the additional test data.
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
getHighscorePercentage()
Gets if the percentage column should be shown.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const ILIAS_VERSION
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
Rich Text Editor base class This class provides access methods to a Rich Text Editor (RTE) integrated...
Definition: class.ilRTE.php:29
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
getAuthor()
Gets the authors name of the ilObjTest object.
MainSettings $main_settings
ilTestEditPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilTestEditPageGUI: ilPublicUse...
getInstantFeedbackSolution()
buildIso8601PeriodForExportCompatibility(DateTimeImmutable $date_time)
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test...
addQTIMaterial(ilXmlWriter &$xml_writer, ?int $page_id, string $material='')
isShowGradingStatusEnabled()
getHighscoreScore()
Gets if the score column should be shown.
getPassScoring()
Gets the pass scoring type.
+ Here is the call graph for this function:

◆ update()

ilObjTest::update ( )

Definition at line 246 of file class.ilObjTest.php.

References ilObject\updateMetaData().

246  : bool
247  {
248  if (!parent::update()) {
249  return false;
250  }
251 
252  // put here object specific stuff
253  $this->updateMetaData();
254  return true;
255  }
+ Here is the call graph for this function:

◆ updateTestPassResults()

ilObjTest::updateTestPassResults ( int  $active_id,
int  $pass,
?ilAssQuestionProcessLocker  $process_locker = null,
?int  $test_obj_id = null 
)

Definition at line 7435 of file class.ilObjTest.php.

References $data, buildExamId(), getQuestionCountAndPointsForPassOfParticipant(), getWorkingTimeOfParticipantForPass(), null, and updateTestResultCache().

7440  : array {
7441  $data = $this->getQuestionCountAndPointsForPassOfParticipant($active_id, $pass);
7442  $time = $this->getWorkingTimeOfParticipantForPass($active_id, $pass);
7443 
7444  $result = $this->db->queryF(
7445  '
7446  SELECT SUM(points) reachedpoints,
7447  SUM(hint_count) hint_count,
7448  SUM(hint_points) hint_points,
7449  COUNT(DISTINCT(question_fi)) answeredquestions
7450  FROM tst_test_result
7451  WHERE active_fi = %s
7452  AND pass = %s
7453  ',
7454  ['integer','integer'],
7455  [$active_id, $pass]
7456  );
7457 
7458  if ($result->numRows() > 0) {
7459  $row = $this->db->fetchAssoc($result);
7460 
7461  if ($row['reachedpoints'] === null
7462  || $row['reachedpoints'] < 0.0) {
7463  $row['reachedpoints'] = 0.0;
7464  }
7465  if ($row['hint_count'] === null) {
7466  $row['hint_count'] = 0;
7467  }
7468  if ($row['hint_points'] === null) {
7469  $row['hint_points'] = 0.0;
7470  }
7471 
7472  $exam_identifier = ilObjTest::buildExamId($active_id, $pass, $test_obj_id);
7473 
7474  $update_pass_result_callback = function () use ($data, $active_id, $pass, $row, $time, $exam_identifier) {
7475  $this->db->replace(
7476  'tst_pass_result',
7477  [
7478  'active_fi' => ['integer', $active_id],
7479  'pass' => ['integer', $pass]
7480  ],
7481  [
7482  'points' => ['float', $row['reachedpoints']],
7483  'maxpoints' => ['float', $data['points']],
7484  'questioncount' => ['integer', $data['count']],
7485  'answeredquestions' => ['integer', $row['answeredquestions']],
7486  'workingtime' => ['integer', $time],
7487  'tstamp' => ['integer', time()],
7488  'hint_count' => ['integer', $row['hint_count']],
7489  'hint_points' => ['float', $row['hint_points']],
7490  'exam_id' => ['text', $exam_identifier]
7491  ]
7492  );
7493  };
7494 
7495  if (is_object($process_locker) && $process_locker instanceof ilAssQuestionProcessLocker) {
7496  $process_locker->executeUserPassResultUpdateLockOperation($update_pass_result_callback);
7497  } else {
7498  $update_pass_result_callback();
7499  }
7500  }
7501 
7502  $this->updateTestResultCache($active_id, $process_locker);
7503 
7504  return [
7505  'active_fi' => $active_id,
7506  'pass' => $pass,
7507  'points' => $row['reachedpoints'],
7508  'maxpoints' => $data['points'],
7509  'questioncount' => $data['count'],
7510  'answeredquestions' => $row['answeredquestions'],
7511  'workingtime' => $time,
7512  'tstamp' => time(),
7513  'hint_count' => $row['hint_count'],
7514  'hint_points' => $row['hint_points'],
7515  'exam_id' => $exam_identifier
7516  ];
7517  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
updateTestResultCache(int $active_id, ?ilAssQuestionProcessLocker $process_locker=null)
getQuestionCountAndPointsForPassOfParticipant(int $active_id, int $pass)
static buildExamId($active_id, $pass, $test_obj_id=null)
getWorkingTimeOfParticipantForPass(int $active_id, int $pass)
+ Here is the call graph for this function:

◆ updateTestResultCache()

ilObjTest::updateTestResultCache ( int  $active_id,
?ilAssQuestionProcessLocker  $process_locker = null 
)

Definition at line 7342 of file class.ilObjTest.php.

References $res, _getResultPass(), getMarkSchema(), ILIAS\Repository\int(), and null.

Referenced by getResultsForActiveId(), and updateTestPassResults().

7342  : void
7343  {
7344  $pass = ilObjTest::_getResultPass($active_id);
7345 
7346  if ($pass !== null) {
7347  $query = '
7348  SELECT tst_pass_result.*,
7349  tst_active.last_finished_pass
7350  FROM tst_pass_result
7351  INNER JOIN tst_active
7352  on tst_pass_result.active_fi = tst_active.active_id
7353  WHERE active_fi = %s
7354  AND pass = %s
7355  ';
7356 
7357  $result = $this->db->queryF(
7358  $query,
7359  ['integer','integer'],
7360  [$active_id, $pass]
7361  );
7362 
7363  $test_pass_result_row = $this->db->fetchAssoc($result);
7364 
7365  if (!is_array($test_pass_result_row)) {
7366  $test_pass_result_row = [];
7367  }
7368  $max = (float) ($test_pass_result_row['maxpoints'] ?? 0);
7369  $reached = (float) ($test_pass_result_row['points'] ?? 0);
7370  $percentage = ($max <= 0.0 || $reached <= 0.0) ? 0 : ($reached / $max) * 100.0;
7371 
7372  $mark = $this->getMarkSchema()->getMatchingMark($percentage);
7373  $is_passed = $pass <= $test_pass_result_row['last_finished_pass'] && $mark->getPassed();
7374 
7375  $hint_count = $test_pass_result_row['hint_count'] ?? 0;
7376  $hint_points = $test_pass_result_row['hint_points'] ?? 0.0;
7377 
7378  $user_test_result_update_callback = function () use ($active_id, $pass, $max, $reached, $is_passed, $hint_count, $hint_points, $mark) {
7379  $passed_once_before = 0;
7380  $query = 'SELECT passed_once FROM tst_result_cache WHERE active_fi = %s';
7381  $res = $this->db->queryF($query, ['integer'], [$active_id]);
7382  while ($passed_once_result_row = $this->db->fetchAssoc($res)) {
7383  $passed_once_before = (int) $passed_once_result_row['passed_once'];
7384  }
7385 
7386  $passed_once = (int) ($is_passed || $passed_once_before);
7387 
7388  $this->db->manipulateF(
7389  'DELETE FROM tst_result_cache WHERE active_fi = %s',
7390  ['integer'],
7391  [$active_id]
7392  );
7393 
7394  if ($reached < 0.0) {
7395  $reached = 0.0;
7396  }
7397 
7398  $mark_short_name = $mark->getShortName();
7399  if ($mark_short_name === '') {
7400  $mark_short_name = ' ';
7401  }
7402 
7403  $mark_official_name = $mark->getOfficialName();
7404  if ($mark_official_name === '') {
7405  $mark_official_name = ' ';
7406  }
7407 
7408  $this->db->insert(
7409  'tst_result_cache',
7410  [
7411  'active_fi' => ['integer', $active_id],
7412  'pass' => ['integer', $pass ?? 0],
7413  'max_points' => ['float', $max],
7414  'reached_points' => ['float', $reached],
7415  'mark_short' => ['text', $mark_short_name],
7416  'mark_official' => ['text', $mark_official_name],
7417  'passed_once' => ['integer', $passed_once],
7418  'passed' => ['integer', (int) $is_passed],
7419  'failed' => ['integer', (int) !$is_passed],
7420  'tstamp' => ['integer', time()],
7421  'hint_count' => ['integer', $hint_count],
7422  'hint_points' => ['float', $hint_points]
7423  ]
7424  );
7425  };
7426 
7427  if (is_object($process_locker)) {
7428  $process_locker->executeUserTestResultUpdateLockOperation($user_test_result_update_callback);
7429  } else {
7430  $user_test_result_update_callback();
7431  }
7432  }
7433  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _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:

◆ updateWorkingTime()

ilObjTest::updateWorkingTime (   $times_id)

Update the working time of a test when a question is answered.

Parameters
integer$times_idThe database id of a working time entry public

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

1603  {
1604  $affectedRows = $this->db->manipulateF(
1605  "UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
1606  ['timestamp', 'integer', 'integer'],
1607  [date('Y-m-d H:i:s'), time(), $times_id]
1608  );
1609  }

◆ userLookupFullName()

ilObjTest::userLookupFullName (   $user_id,
  $overwrite_anonymity = false,
  $sorted_order = false,
  $suffix = "" 
)

Returns the full name of a test user according to the anonymity status.

Parameters
int$user_idThe database ID of the user
boolean$overwrite_anonymityIndicates if the anonymity status should be ignored
Returns
string The full name of the user or UNKNOWN if the anonymity status is affected public
Deprecated:
: use ilTestParticipantData instead

Definition at line 5608 of file class.ilObjTest.php.

References $user_id, ilObjUser\_lookupName(), getAnonymity(), and ILIAS\Repository\lng().

Referenced by sendAdvancedNotification(), and sendSimpleNotification().

5608  : string
5609  {
5610  if ($this->getAnonymity() && !$overwrite_anonymity) {
5611  return $this->lng->txt("anonymous") . $suffix;
5612  } else {
5613  $uname = ilObjUser::_lookupName($user_id);
5614  if (strlen($uname["firstname"] . $uname["lastname"]) == 0) {
5615  $uname["firstname"] = $this->lng->txt("deleted_user");
5616  }
5617  if ($sorted_order) {
5618  return trim($uname["lastname"] . ", " . $uname["firstname"]) . $suffix;
5619  } else {
5620  return trim($uname["firstname"] . " " . $uname["lastname"]) . $suffix;
5621  }
5622  }
5623  }
static _lookupName(int $a_user_id)
lookup user name
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access_filtered_participant_list

ilTestParticipantList ilObjTest::$access_filtered_participant_list = null
protected

◆ $activation_ending_time

int ilObjTest::$activation_ending_time = null
protected

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

Referenced by getActivationEndingTime().

◆ $activation_limited

bool ilObjTest::$activation_limited = null
private

Definition at line 79 of file class.ilObjTest.php.

Referenced by isActivationLimited().

◆ $activation_starting_time

int ilObjTest::$activation_starting_time = null
protected

Definition at line 112 of file class.ilObjTest.php.

Referenced by getActivationStartingTime().

◆ $activation_visibility

bool ilObjTest::$activation_visibility = false
protected

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

Referenced by getActivationVisibility().

◆ $author

string ilObjTest::$author

Definition at line 89 of file class.ilObjTest.php.

◆ $bench

ilBenchmark ilObjTest::$bench
protected

Definition at line 128 of file class.ilObjTest.php.

◆ $component_factory

ilComponentFactory ilObjTest::$component_factory
private

Definition at line 144 of file class.ilObjTest.php.

◆ $component_repository

ilComponentRepository ilObjTest::$component_repository
private

Definition at line 143 of file class.ilObjTest.php.

◆ $ctrl

ilCtrlInterface ilObjTest::$ctrl
protected

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

◆ $evaluation_data

ilObjTest::$evaluation_data

Contains the evaluation data settings the tutor defines for the user.

Definition at line 100 of file class.ilObjTest.php.

◆ $export_factory

ExportImportFactory ilObjTest::$export_factory
protected

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

◆ $file_ids

array ilObjTest::$file_ids = []
private

Definition at line 81 of file class.ilObjTest.php.

◆ $filesystem_web

Filesystem ilObjTest::$filesystem_web
private

Definition at line 145 of file class.ilObjTest.php.

◆ $global_settings_repo

GlobalSettingsRepository ilObjTest::$global_settings_repo
protected

Definition at line 131 of file class.ilObjTest.php.

◆ $invitation

int ilObjTest::$invitation = self::INVITATION_OFF

Definition at line 88 of file class.ilObjTest.php.

◆ $isSkillManagementGloballyActivated

ilObjTest::$isSkillManagementGloballyActivated = null
staticprivate

Definition at line 7142 of file class.ilObjTest.php.

◆ $lo_metadata

LOMetadata ilObjTest::$lo_metadata
protected

Definition at line 150 of file class.ilObjTest.php.

◆ $log_viewer

TestLogViewer ilObjTest::$log_viewer
protected

Definition at line 138 of file class.ilObjTest.php.

Referenced by getTestLogViewer().

◆ $logger

TestLogger ilObjTest::$logger
protected

Definition at line 137 of file class.ilObjTest.php.

Referenced by getTestLogger().

◆ $main_settings

MainSettings ilObjTest::$main_settings = null
protected

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

Referenced by fromXML(), and getMainSettings().

◆ $main_settings_repo

MainSettingsRepository ilObjTest::$main_settings_repo = null
protected

Definition at line 133 of file class.ilObjTest.php.

Referenced by getMainSettingsRepository().

◆ $mark_schema

MarkSchema ilObjTest::$mark_schema = null
private

Definition at line 86 of file class.ilObjTest.php.

Referenced by getMarkSchema().

◆ $marks_repository

MarksRepository ilObjTest::$marks_repository
private

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

◆ $metadata

ilObjTest::$metadata

A reference to an IMS compatible matadata set.

Definition at line 94 of file class.ilObjTest.php.

Referenced by fromXML().

◆ $mob_ids

array ilObjTest::$mob_ids
private

Definition at line 80 of file class.ilObjTest.php.

◆ $online

bool ilObjTest::$online
private

Definition at line 82 of file class.ilObjTest.php.

Referenced by isOnline().

◆ $participant_access_filter

ilTestParticipantAccessFilterFactory ilObjTest::$participant_access_filter
protected

Definition at line 129 of file class.ilObjTest.php.

◆ $participant_repository

ParticipantRepository ilObjTest::$participant_repository
protected

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

◆ $participantDataExist

ilObjTest::$participantDataExist = null
private

holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilObjTest::paricipantDataExist() since this method initialises this property

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

Referenced by participantDataExist().

◆ $print_best_solution_with_result

bool ilObjTest::$print_best_solution_with_result = true
protected

Definition at line 109 of file class.ilObjTest.php.

◆ $question_set_config_factory

ilTestQuestionSetConfigFactory ilObjTest::$question_set_config_factory
protected

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

◆ $questionrepository

GeneralQuestionPropertiesRepository ilObjTest::$questionrepository
protected

Definition at line 83 of file class.ilObjTest.php.

Referenced by getGeneralQuestionPropertiesRepository().

◆ $questions

array ilObjTest::$questions = []

Definition at line 95 of file class.ilObjTest.php.

Referenced by getQuestions(), getTestQuestions(), and moveQuestions().

◆ $refinery

Refinery ilObjTest::$refinery
protected

Definition at line 126 of file class.ilObjTest.php.

◆ $score_settings

ScoreSettings ilObjTest::$score_settings = null
protected

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

Referenced by fromXML(), and getScoreSettings().

◆ $score_settings_repo

ScoreSettingsRepository ilObjTest::$score_settings_repo = null
protected

Definition at line 135 of file class.ilObjTest.php.

Referenced by getScoreSettingsRepository().

◆ $settings

ilSetting ilObjTest::$settings
protected

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

◆ $template_id

int ilObjTest::$template_id = 0
private

Definition at line 107 of file class.ilObjTest.php.

Referenced by getTemplate(), and setTemplate().

◆ $test_id

int ilObjTest::$test_id = -1

Definition at line 87 of file class.ilObjTest.php.

Referenced by _getTestIDFromObjectID(), and getTestId().

◆ $test_man_scoring_done_helper

TestManScoringDoneHelper ilObjTest::$test_man_scoring_done_helper
private

Definition at line 124 of file class.ilObjTest.php.

◆ $test_sequence

ilObjTest::$test_sequence = false

contains the test sequence data

Definition at line 105 of file class.ilObjTest.php.

Referenced by getTestResult(), isParticipantsLastPassActive(), and removeQuestionFromSequences().

◆ $testrequest

RequestDataCollector ilObjTest::$testrequest
private

Definition at line 84 of file class.ilObjTest.php.

◆ $tmpCopyWizardCopyId

int ilObjTest::$tmpCopyWizardCopyId = null
private

Definition at line 122 of file class.ilObjTest.php.

Referenced by getTmpCopyWizardCopyId(), and setTmpCopyWizardCopyId().

◆ INVITATION_OFF

const ilObjTest::INVITATION_OFF = 0

Definition at line 70 of file class.ilObjTest.php.

◆ INVITATION_ON

const ilObjTest::INVITATION_ON = 1

Definition at line 71 of file class.ilObjTest.php.

◆ QUESTION_SET_TYPE_FIXED

◆ QUESTION_SET_TYPE_RANDOM

◆ REDIRECT_ALWAYS

const ilObjTest::REDIRECT_ALWAYS = 1

◆ REDIRECT_KIOSK

const ilObjTest::REDIRECT_KIOSK = 2

◆ REDIRECT_NONE

const ilObjTest::REDIRECT_NONE = 0

◆ SCORE_BEST_PASS

◆ SCORE_LAST_PASS


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