Inheritance diagram for ilObjTest:
Collaboration diagram for ilObjTest:Public Member Functions | |
| ilObjTest ($a_id=0, $a_call_by_reference=true) | |
| Constructor public. | |
| create ($a_upload=false) | |
| create test object | |
| update () | |
| update object data | |
| createReference () | |
| Creates a database reference id for the object. | |
| read ($a_force_db=false) | |
| read object data from db into object | |
| delete () | |
| delete object and all related data | |
| deleteTest () | |
| Deletes the test and all related objects, files and database entries. | |
| initDefaultRoles () | |
| init default roles settings | |
| notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0) | |
| notifys an object about an event occured Based on the event happend, each object may decide how it reacts. | |
| 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) | |
| getExportDirectory () | |
| Get the location of the export directory for the test. | |
| getExportFiles ($dir) | |
| Get a list of the already exported files in the export directory. | |
| _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) | |
| _getImportDirectory () | |
| Get the import directory location of the test. | |
| 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) | |
| getImportDirectory () | |
| Get the import directory location of the test. | |
| testTitleExists ($title) | |
| Returns TRUE if the test title exists in the database. | |
| isComplete () | |
| Returns true, if a test is complete for use. | |
| _isComplete ($obj_id) | |
| Returns true, if a test is complete for use. | |
| saveECTSStatus ($ects_output=0, $fx_support="", $ects_a=90, $ects_b=65, $ects_c=35, $ects_d=10, $ects_e=0) | |
| Saves the ECTS status (output of ECTS grades in a test) to the database. | |
| saveCompleteStatus () | |
| Checks if the test is complete and saves the status in the database. | |
| getAllRTEContent () | |
| Returns the content of all RTE enabled text areas in the test. | |
| cleanupMediaobjectUsage () | |
| Cleans up the media objects for all text fields in a test which are using an RTE field. | |
| saveToDb ($properties_only=FALSE) | |
| Saves a ilObjTest object to a database. | |
| saveQuestionsToDb () | |
| Saves the test questions to the database. | |
| saveRandomQuestion ($active_id, $question_id, $pass=NULL, $maxcount) | |
| Saves a random question to the database. | |
| getRandomQuestionDuplicate ($question_id, $active_id) | |
| Returns the question id of the duplicate of a question which is already in use in a random test. | |
| getNrOfResultsForPass ($active_id, $pass) | |
| Calculates the number of user results for a specific test pass. | |
| hasRandomQuestionsForPass ($active_id, $pass) | |
| Checkes wheather a random test has already created questions for a given pass or not. | |
| generateRandomQuestions ($active_id, $pass=NULL) | |
| Generates new random questions for the active user. | |
| saveRandomQuestionCount ($total_questions="NULL") | |
| Saves the total amount of a tests random questions to the database. | |
| saveRandomQuestionpools ($qpl_array) | |
| Saves the question pools used for a random test. | |
| & | getRandomQuestionpools () |
| Returns an array containing the random questionpools saved to the database. | |
| loadFromDb () | |
| Loads a ilObjTest object from a database. | |
| loadQuestions ($active_id="", $pass=NULL) | |
| Load the test question id's from the database. | |
| setIntroduction ($introduction="") | |
| Sets the introduction. | |
| isRandomTest () | |
| Gets the status of the $random_test attribute. | |
| getRandomTest () | |
| Gets the status of the $random_test attribute. | |
| getRandomQuestionCount () | |
| Gets the number of random questions used for a random test. | |
| getIntroduction () | |
| Gets the introduction. | |
| getTestId () | |
| Gets the database id of the additional test data. | |
| getECTSOutput () | |
| Indicates if ECTS grades output is presented in this test. | |
| setECTSOutput ($a_ects_output) | |
| Enables/Disables ECTS grades output for this test. | |
| getECTSFX () | |
| Returns the ECTS FX grade. | |
| setECTSFX ($a_ects_fx) | |
| Sets the ECTS FX grade. | |
| & | getECTSGrades () |
| Returns the ECTS grades. | |
| setECTSGrades ($a_ects_grades) | |
| Sets the ECTS grades. | |
| setSequenceSettings ($sequence_settings=0) | |
| Sets the sequence settings. | |
| setScoreReporting ($score_reporting=0) | |
| Sets the score reporting. | |
| setInstantFeedbackSolution ($instant_feedback=0) | |
| Sets the instant feedback for the solution. | |
| setAnswerFeedback ($answer_feedback=0) | |
| Sets the answer specific feedback for the test. | |
| setAnswerFeedbackPoints ($answer_feedback_points=0) | |
| Sets the answer specific feedback of reached points for the test. | |
| setRandomTest ($a_random_test=0) | |
| Sets the random test indicator. | |
| setRandomQuestionCount ($a_random_question_count="") | |
| Sets the random question count. | |
| setReportingDate ($reporting_date) | |
| Sets the reporting date. | |
| getSequenceSettings () | |
| Gets the sequence settings. | |
| getScoreReporting () | |
| Gets the score reporting. | |
| getInstantFeedbackSolution () | |
| Returns 1 if the correct solution will be shown after answering a question. | |
| getAnswerFeedback () | |
| Returns 1 if answer specific feedback is activated. | |
| getAnswerFeedbackPoints () | |
| Returns 1 if answer specific feedback as reached points is activated. | |
| getCountSystem () | |
| Gets the count system for the calculation of points. | |
| _getCountSystem ($active_id) | |
| Gets the count system for the calculation of points. | |
| getMCScoring () | |
| Gets the scoring type for multiple choice questions. | |
| getScoreCutting () | |
| Determines if the score of a question should be cut at 0 points or the score of the whole test. | |
| getPassword () | |
| Returns the password for test access. | |
| getPassScoring () | |
| Gets the pass scoring type. | |
| _getPassScoring ($active_id) | |
| Gets the pass scoring type. | |
| _getMCScoring ($active_id) | |
| Gets the scoring type for multiple choice questions. | |
| _getScoreCutting ($active_id) | |
| Determines if the score of a question should be cut at 0 points or the score of the whole test. | |
| getReportingDate () | |
| Gets the reporting date. | |
| getNrOfTries () | |
| Returns the nr of tries for the test. | |
| getUsePreviousAnswers () | |
| Returns if the previous answers should be shown for a learner. | |
| getTitleOutput () | |
| Returns the value of the title_output status. | |
| _getTitleOutput ($active_id) | |
| Returns the value of the title_output status. | |
| _getUsePreviousAnswers ($active_id, $user_active_user_setting=false) | |
| Returns if the previous results should be hidden for a learner. | |
| getProcessingTime () | |
| Returns the processing time for the test. | |
| getProcessingTimeInSeconds () | |
| Returns the processing time for the test in seconds. | |
| getSecondsUntilEndingTime () | |
| Returns the seconds left from the actual time until the ending time. | |
| getEnableProcessingTime () | |
| Returns the state of the processing time (enabled/disabled). | |
| getResetProcessingTime () | |
| Returns wheather the processing time should be reset or not. | |
| getStartingTime () | |
| Returns the starting time of the test. | |
| getEndingTime () | |
| Returns the ending time of the test. | |
| setNrOfTries ($nr_of_tries=0) | |
| Sets the nr of tries for the test. | |
| setUsePreviousAnswers ($use_previous_answers=1) | |
| Sets the status of the visibility of previous learner answers. | |
| setTitleOutput ($title_output=0) | |
| Sets the status of the title output. | |
| setProcessingTime ($processing_time="00:00:00") | |
| Sets the processing time for the test. | |
| setEnableProcessingTime ($enable=0) | |
| Sets the processing time enabled or disabled. | |
| setResetProcessingTime ($reset=0) | |
| Sets wheather the processing time should be reset or not. | |
| setStartingTime ($starting_time="") | |
| Sets the starting time for the test. | |
| setEndingTime ($ending_time="") | |
| Sets the ending time for the test. | |
| setCountSystem ($a_count_system=COUNT_PARTIAL_SOLUTIONS) | |
| Sets the count system for the calculation of points. | |
| setPassword ($a_password="") | |
| Sets the password for test access. | |
| setScoreCutting ($a_score_cutting=SCORE_CUT_QUESTION) | |
| Sets the type of score cutting. | |
| setMCScoring ($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED) | |
| Sets the multiple choice scoring. | |
| setPassScoring ($a_pass_scoring=SCORE_LAST_PASS) | |
| Sets the pass scoring. | |
| removeQuestion ($question_id) | |
| Removes a question from the test object. | |
| removeAllTestEditings ($question_id="") | |
| Removes all references to the question in executed tests in case the question has been changed. | |
| removeSelectedTestResults ($active_ids) | |
| removeTestResultsForUser ($user_id) | |
| questionMoveUp ($question_id) | |
| Moves a question up in order. | |
| questionMoveDown ($question_id) | |
| Moves a question down in order. | |
| duplicateQuestionForTest ($question_id) | |
| Takes a question and creates a copy of the question for use in the test. | |
| insertQuestion ($question_id) | |
| Insert a question in the list of questions. | |
| & | getQuestionTitles () |
| Returns the titles of the test questions in question sequence. | |
| getQuestionTitle ($title) | |
| Returns the title of a test question. | |
| getQuestionDataset ($question_id) | |
| Returns the dataset for a given question id. | |
| & | getExistingQuestions ($pass=NULL) |
| Get the id's of the questions which are already part of the test. | |
| getQuestionType ($question_id) | |
| Returns the question type of a question with a given id. | |
| startWorkingTime ($active_id, $pass) | |
| Write the initial entry for the tests working time to the database. | |
| updateWorkingTime ($times_id) | |
| Update the working time of a test when a question is answered. | |
| & | getWorkedQuestions ($active_id, $pass=NULL) |
| Gets the id's of all questions a user already worked through. | |
| isTestFinishedToViewResults ($active_id, $currentpass) | |
| Returns true if an active user completed a test pass and did not start a new pass. | |
| & | getAllQuestions ($pass=NULL) |
| Returns all questions of a test in test order. | |
| getActiveIdOfUser ($user_id="", $anonymous_id="") | |
| Gets the active id of a given user. | |
| _getActiveIdOfUser ($user_id="", $test_id="") | |
| Gets the active id of the tst_active table for the active user. | |
| pcArrayShuffle ($array) | |
| Shuffles the values of a given array. | |
| & | getTestResult ($active_id, $pass=NULL, $ordered_sequence=FALSE) |
| Calculates the results of a test for a given user. | |
| evalTotalPersons () | |
| Returns the number of persons who started the test. | |
| getCompleteWorkingTime ($user_id) | |
| Returns the complete working time in seconds a user worked on the test. | |
| & | getCompleteWorkingTimeOfParticipants () |
| Returns the complete working time in seconds for all test participants. | |
| & | _getCompleteWorkingTimeOfParticipants ($test_id) |
| Returns the complete working time in seconds for all test participants. | |
| getCompleteWorkingTimeOfParticipant ($active_id) | |
| Returns the complete working time in seconds for a test participant. | |
| getVisitTimeOfParticipant ($active_id) | |
| Returns the first and last visit of a participant. | |
| _getVisitTimeOfParticipant ($test_id, $active_id) | |
| Returns the first and last visit of a participant. | |
| & | evalStatistical ($active_id) |
| Returns the statistical evaluation of the test for a specified user. | |
| & | getTotalPointsPassedArray () |
| Returns an array with the total points of all users who passed the test. | |
| & | getParticipants () |
| Returns all persons who started the test. | |
| & | evalTotalPersonsArray ($name_sort_order="asc") |
| Returns all persons who started the test. | |
| & | evalTotalParticipantsArray ($name_sort_order="asc") |
| Returns all participants who started the test. | |
| evalTotalFinished () | |
| Returns the number of total finished tests. | |
| & | getQuestionsOfTest ($active_id) |
| Retrieves all the assigned questions for all test passes of a test participant. | |
| & | getQuestionsOfPass ($active_id, $pass) |
| Retrieves all the assigned questions for a test participant in a given test pass. | |
| getUnfilteredEvaluationData () | |
| & | getCompleteEvaluationData ($withStatistics=TRUE, $filterby="", $filtertext="") |
| & | _getCompleteEvaluationData ($test_id, $withStatistics=TRUE, $active_id="") |
| & | evalResultsOverview () |
| Creates an associated array with the results of all participants of a test. | |
| & | _evalResultsOverview ($test_id) |
| Creates an associated array with the results of all participants of a test. | |
| & | evalResultsOverviewOfParticipant ($active_id) |
| Creates an associated array with the results for a given participant of a test. | |
| buildName ($user_id, $firstname, $lastname, $title) | |
| Builds a user name for the output. | |
| _buildName ($is_anonymous, $user_id, $firstname, $lastname, $title) | |
| Builds a user name for the output. | |
| evalTotalStartedAverageTime () | |
| Returns the average processing time for all started tests. | |
| & | getAvailableQuestionpools ($use_object_id=false, $equal_points=false, $could_be_offline=false, $show_path=FALSE, $with_questioncount=FALSE, $permission="read") |
| Returns the available question pools for the active user. | |
| getEstimatedWorkingTime () | |
| Returns the estimated working time for the test calculated from the working time of the contained questions. | |
| randomSelectQuestions ($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=NULL) | |
| Returns a random selection of questions. | |
| getImagePath () | |
| Returns the image path for web accessable images of a test. | |
| getImagePathWeb () | |
| Returns the web image path for web accessable images of a test. | |
| & | createQuestionGUI ($question_type, $question_id=-1) |
| Creates a question GUI instance of a given question type. | |
| & | _instanciateQuestion ($question_id) |
| Creates an instance of a question with a given question id. | |
| moveQuestions ($move_questions, $target_index, $insert_mode) | |
| Move questions to another position. | |
| startingTimeReached () | |
| Returns true if the starting time of a test is reached. | |
| endingTimeReached () | |
| Returns true if the ending time of a test is reached. | |
| getQuestionsTable ($sort, $sortorder, $textfilter, $startrow=0, $completeonly=0, $filter_question_type="", $filter_questionpool="") | |
| Calculates the data for the output of the questionpool. | |
| fromXML (&$assessment) | |
| Creates a test from a QTI file. | |
| toXML () | |
| Returns a QTI xml representation of the test. | |
| exportPagesXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) | |
| export pages of test to xml (see ilias_co.dtd) | |
| exportXMLMetaData (&$a_xml_writer) | |
| export content objects meta data to xml (see ilias_co.dtd) | |
| modifyExportIdentifier ($a_tag, $a_param, $a_value) | |
| Returns the installation id for a given identifier. | |
| exportXMLPageObjects (&$a_xml_writer, $a_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) | |
| exportFileItems ($a_target_dir, &$expLog) | |
| export files of file itmes | |
| getImportMapping () | |
| get array of (two) new created questions for import id | |
| getECTSGrade ($reached_points, $max_points) | |
| Returns the ECTS grade for a number of reached points. | |
| _getECTSGrade ($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx) | |
| Returns the ECTS grade for a number of reached points. | |
| checkMarks () | |
| setAuthor ($author="") | |
| Sets the authors name. | |
| saveAuthorToMetadata ($a_author="") | |
| Saves an authors name into the lifecycle metadata if no lifecycle metadata exists. | |
| createMetaData () | |
| Create meta data entry. | |
| getAuthor () | |
| Gets the authors name. | |
| _lookupAuthor ($obj_id) | |
| Gets the authors name. | |
| & | _getAvailableTests ($use_object_id=FALSE) |
| Returns the available tests for the active user. | |
| cloneRandomQuestions ($new_id) | |
| Duplicates the source random questionpools for another test. | |
| cloneObject ($a_target_id, $a_copy_id=0) | |
| Clone object. | |
| _getRefIdFromObjId ($obj_id) | |
| getQuestionCount () | |
| Returns the number of questions in the test. | |
| _getQuestionCount ($test_id) | |
| Returns the number of questions in the test for a given user. | |
| removeNonRandomTestData () | |
| Removes all test data of a non random test when a test was set to random test. | |
| removeRandomTestData () | |
| Removes all test data of a random test when a test was set to non random test. | |
| logAction ($logtext="", $question_id="") | |
| Logs an action into the Test&Assessment log. | |
| _getObjectIDFromTestID ($test_id) | |
| Returns the ILIAS test object id for a given test id. | |
| _getObjectIDFromActiveID ($active_id) | |
| Returns the ILIAS test object id for a given active id. | |
| _getTestIDFromObjectID ($object_id) | |
| Returns the ILIAS test id for a given object id. | |
| getTextAnswer ($active_id, $question_id, $pass=NULL) | |
| Returns the text answer of a given user for a given question. | |
| getQuestiontext ($question_id) | |
| Returns the question text for a given question. | |
| & | getInvitedUsers ($user_id="", $order="login, lastname, firstname") |
| Returns a list of all invited users in a test. | |
| & | getTestParticipants () |
| Returns a list of all participants in a test. | |
| & | getUserData ($ids) |
| Returns a data of all users specified by id list. | |
| & | getArrayData ($query, $id_field) |
| Returns a data as id key list. | |
| & | _getArrayData ($query, $id_field) |
| & | getGroupData ($ids) |
| & | getRoleData ($ids) |
| inviteGroup ($group_id) | |
| Invites all users of a group to a test. | |
| inviteRole ($role_id) | |
| Invites all users of a role to a test. | |
| disinviteUser ($user_id) | |
| Disinvites a user from a test. | |
| inviteUser ($user_id, $client_ip="") | |
| Invites a user to a test. | |
| setClientIP ($user_id, $client_ip) | |
| _getSolvedQuestions ($active_id, $question_fi=null) | |
| get solved questions | |
| setQuestionSetSolved ($value, $question_id, $user_id) | |
| sets question solved state to value for given user_id | |
| setActiveTestSubmitted ($user_id) | |
| submits active test for user user_id | |
| isActiveTestSubmitted ($user_id=null) | |
| returns if the active for user_id has been submitted | |
| hasNrOfTriesRestriction () | |
| returns if the numbers of tries have to be checked | |
| isNrOfTriesReached ($tries) | |
| returns if number of tries are reached | |
| & | processCSVRow ($row, $quoteAll=FALSE, $separator=";") |
| Convertes an array for CSV usage. | |
| _getPass ($active_id) | |
| Retrieves the actual pass of a given user for a given test. | |
| _getMaxPass ($active_id) | |
| Retrieves the maximum pass of a given user for a given test. | |
| _getBestPass ($active_id) | |
| Retrieves the best pass of a given user for a given test. | |
| _getResultPass ($active_id) | |
| Retrieves the pass number that should be counted for a given user. | |
| getAnsweredQuestionCount ($active_id, $pass=NULL) | |
| Retrieves the number of answered questions for a given user in a given test. | |
| getPassFinishDate ($active_id, $pass) | |
| Retrieves the number of answered questions for a given user in a given test. | |
| isExecutable ($user_id, $allowPassIncrease=FALSE) | |
| Checks if the test is executable by the given user. | |
| canViewResults () | |
| Returns true, if the test results can be viewed. | |
| canShowTestResults ($user_id) | |
| canEditMarks () | |
| getStartingTimeOfUser ($active_id) | |
| Returns the unix timestamp of the time a user started a test. | |
| isMaxProcessingTimeReached ($starting_time) | |
| Returns wheather the maximum processing time for a test is reached or not. | |
| & | getTestQuestions () |
| getShuffleQuestions () | |
| Returns the status of the shuffle_questions variable. | |
| setShuffleQuestions ($a_shuffle) | |
| Sets the status of the shuffle_questions variable. | |
| getListOfQuestionsSettings () | |
| Returns the settings for the list of questions options in the test properties. | |
| setListOfQuestionsSettings ($a_value=0) | |
| Sets the settings for the list of questions options in the test properties. | |
| getListOfQuestions () | |
| Returns if the list of questions should be presented to the user or not. | |
| setListOfQuestions ($a_value=TRUE) | |
| Sets if the the list of questions should be presented to the user or not. | |
| getListOfQuestionsStart () | |
| Returns if the list of questions should be presented as the first page of the test. | |
| setListOfQuestionsStart ($a_value=TRUE) | |
| Sets if the the list of questions as the start page of the test. | |
| getListOfQuestionsEnd () | |
| Returns if the list of questions should be presented as the last page of the test. | |
| setListOfQuestionsEnd ($a_value=TRUE) | |
| Sets if the the list of questions as the end page of the test. | |
| getListOfQuestionsDescription () | |
| Returns TRUE if the list of questions should be presented with the question descriptions. | |
| setListOfQuestionsDescription ($a_value=TRUE) | |
| Sets the show_summary attribute to TRUE if the list of questions should be presented with the question descriptions. | |
| getResultsPresentation () | |
| Returns the combined results presentation value. | |
| getShowPassDetails () | |
| Returns if the pass details should be shown when a test is not finished. | |
| getShowSolutionDetails () | |
| Returns if the solution details should be presented to the user or not. | |
| getShowSolutionPrintview () | |
| Returns if the solution printview should be presented to the user or not. | |
| getShowSolutionFeedback () | |
| Returns if the feedback should be presented to the solution or not. | |
| getShowSolutionAnswersOnly () | |
| Returns if the full solution (including ILIAS content) should be presented to the solution or not. | |
| getShowSolutionSignature () | |
| Returns if the signature field should be shown in the test results. | |
| setResultsPresentation ($a_results_presentation=3) | |
| Sets the combined results presentation value. | |
| setShowPassDetails ($a_details=1) | |
| Sets if the pass details should be shown when a test is not finished. | |
| setShowSolutionDetails ($a_details=1) | |
| Sets if the the solution details should be presented to the user or not. | |
| canShowSolutionPrintview ($user_id=NULL) | |
| Calculates if a user may see the solution printview of his/her test results. | |
| setShowSolutionPrintview ($a_printview=1) | |
| Sets if the the solution printview should be presented to the user or not. | |
| setShowSolutionFeedback ($a_feedback=TRUE) | |
| Sets if the the feedback should be presented to the user in the solution or not. | |
| setShowSolutionAnswersOnly ($a_full=TRUE) | |
| Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution output. | |
| setShowSolutionSignature ($a_signature=TRUE) | |
| Set to TRUE, if the signature field should be shown in the solution. | |
| & | _getPassedUsers ($a_obj_id) |
| Returns an array containing the user ids of all users who passed the test. | |
| createNewAccessCode () | |
| Returns a new, unused test access code. | |
| isAccessCodeUsed ($code) | |
| _getUserIdFromActiveId ($active_id) | |
| getAccessCodeSession () | |
| setAccessCodeSession ($access_code) | |
| unsetAccessCodeSession () | |
| getAllowedUsers () | |
| setAllowedUsers ($a_allowed_users) | |
| getAllowedUsersTimeGap () | |
| setAllowedUsersTimeGap ($a_allowed_users_time_gap) | |
| checkMaximumAllowedUsers () | |
| _getLastAccess ($active_id) | |
| isHTML ($a_text) | |
| Checks if a given string contains HTML or not. | |
| QTIMaterialToString ($a_material) | |
| Reads an QTI material tag an creates a text string. | |
| addQTIMaterial (&$a_xml_writer, $a_material) | |
| Creates a QTI material tag from a plain text or xhtml text. | |
| prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE) | |
| Prepares a string for a text area output in tests. | |
| saveCertificateVisibility ($a_value) | |
| Saves the visibility settings of the certificate. | |
| getCertificateVisibility () | |
| Returns the visibility settings of the certificate. | |
| setCertificateVisibility ($a_value) | |
| Sets the visibility settings of the certificate. | |
| getAnonymity () | |
| Returns the anonymity status of the test. | |
| setAnonymity ($a_value=0) | |
| Sets the anonymity status of the test. | |
| getShowCancel () | |
| Returns wheather the cancel test button is shown or not. | |
| setShowCancel ($a_value=1) | |
| Sets the cancel test button status. | |
| getShowMarker () | |
| Returns wheather the marker button is shown or not. | |
| setShowMarker ($a_value=1) | |
| Sets the marker button status. | |
| getFixedParticipants () | |
| Returns the fixed participants status. | |
| setFixedParticipants ($a_value=1) | |
| Sets the fixed participants status. | |
| _lookupAnonymity ($a_obj_id) | |
| Returns the anonymity status of a test with a given object id. | |
| _lookupRandomTestFromActiveId ($active_id) | |
| Returns the random status of a test with a given object id. | |
| userLookupFullName ($user_id, $overwrite_anonymity=FALSE, $sorted_order=FALSE, $suffix="") | |
| Returns the full name of a test user according to the anonymity status. | |
| getStartTestLabel ($active_id) | |
| Returns the "Start the Test" label for the Info page. | |
| & | getAvailableDefaults ($sortby="name", $sortorder="asc") |
| Returns the available test defaults for the active user. | |
| & | getTestDefaults ($test_defaults_id) |
| Returns the test defaults for a given id. | |
| deleteDefaults ($test_default_id) | |
| Deletes the defaults for a test. | |
| addDefaults ($a_name) | |
| Adds the defaults of this test to the test defaults. | |
| applyDefaults ($test_defaults_id) | |
| Applies given test defaults to this test. | |
| processPrintoutput2FO ($print_output) | |
| Convert a print output to XSL-FO. | |
| deliverPDFfromFO ($fo) | |
| Delivers a PDF file from a XSL-FO string. | |
| saveManualFeedback ($active_id, $question_id, $pass, $feedback) | |
| Saves the manual feedback for a question in a test. | |
| getJavaScriptOutput () | |
| Returns if Javascript should be chosen for drag & drop actions for the active user. | |
| & | createTestSession () |
| Creates the test session data for the active user. | |
| & | setTestSession ($active_id="") |
| Sets the test session data for the active user. | |
| & | getTestSession ($active_id="") |
| Returns the test session data for the active user. | |
| & | createTestSequence ($active_id, $pass, $shuffle) |
| & | getTestSequence ($active_id="", $pass="") |
| hideCorrectAnsweredQuestions () | |
| _lookupTestObjIdForQuestionId ($a_q_id) | |
| Get test Object ID for question ID. | |
| canShowCertificate ($user_id, $active_id) | |
| Checks wheather the certificate button could be shown on the info page or not. | |
Static Public Member Functions | |
| static | getManualFeedback ($active_id, $question_id, $pass) |
| Retrieves the manual feedback for a question in a test. | |
Data Fields | |
| $test_id | |
| $invitation = INVITATION_OFF | |
| $author | |
| $metadata | |
| $questions | |
| $introduction | |
| $mark_schema | |
| $sequence_settings | |
| $score_reporting | |
| $instant_verification | |
| $answer_feedback_points | |
| $reporting_date | |
| $evaluation_data | |
| $nr_of_tries | |
| $use_previous_answers | |
| $title_output | |
| $processing_time | |
| $enable_processing_time | |
| $reset_processing_time | |
| $starting_time | |
| $ending_time | |
| $ects_output | |
| $ects_fx | |
| $ects_grades | |
| $random_test | |
| $random_question_count | |
| $count_system | |
| $mc_scoring | |
| $pass_scoring | |
| $shuffle_questions | |
| $results_presentation | |
| $show_summary | |
| $score_cutting | |
| $password | |
| $allowedUsers | |
| $allowedUsersTimeGap | |
| $certificate_visibility | |
| $anonymity | |
| $show_cancel | |
| $show_marker | |
| $fixed_participants | |
| $answer_feedback | |
| $testSession | |
| $testSequence | |
Private Member Functions | |
| getMembershipByType ($a_usr_id, $a_type) | |
Definition at line 37 of file class.ilObjTest.php.
| ilObjTest::_buildName | ( | $ | is_anonymous, | |
| $ | user_id, | |||
| $ | firstname, | |||
| $ | lastname, | |||
| $ | title | |||
| ) |
Builds a user name for the output.
Builds a user name for the output depending on test type and existence of the user
| boolean | $is_anonymous Indicates if it is an anonymized test or not | |
| int | $user_id The database ID of the user | |
| string | $firstname The first name of the user | |
| string | $lastname The last name of the user | |
| string | $title The title of the user |
Definition at line 5005 of file class.ilObjTest.php.
References ilObject::$lng, and ilObject::$title.
Referenced by _getCompleteEvaluationData().
{
global $lng;
$name = "";
if (strlen($firstname.$lastname.$title) == 0)
{
$name = $lng->txt("deleted_user");
}
else
{
if ($user_id == ANONYMOUS_USER_ID)
{
$name = $lastname;
}
else
{
$name = trim($lastname . ", " . $firstname . " " . $title);
}
if ($is_anonymous)
{
$name = $lng->txt("anonymous");
}
}
return $name;
}
Here is the caller graph for this function:| ilObjTest::_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)
Definition at line 861 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
Referenced by ilObjTestGUI::uploadTstObject().
{
global $ilias;
include_once "./Services/Utilities/classes/class.ilUtil.php";
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$ilias->raiseError("Test data directory (".$tst_data_dir
.") not writeable.",$ilias->error_obj->FATAL);
}
// create test directory (data_dir/tst_data/tst_import)
$tst_dir = $tst_data_dir."/tst_import";
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$ilias->raiseError("Creation of test import directory failed.",$ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::_evalResultsOverview | ( | $ | test_id | ) |
Creates an associated array with the results of all participants of a test.
Creates an associated array with the results of all participants of a test
Definition at line 4859 of file class.ilObjTest.php.
References $test_id.
Referenced by evalResultsOverview().
{
global $ilDB;
$query = sprintf("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_test_result.*, qpl_questions.original_id, qpl_questions.title AS questiontitle, " .
"qpl_questions.points AS maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s " .
"ORDER BY active_id, pass, TIMESTAMP",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
$overview = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if (!array_key_exists($row["active_fi"], $overview))
{
$overview[$row["active_fi"]] = array();
$overview[$row["active_fi"]]["firstname"] = $row["firstname"];
$overview[$row["active_fi"]]["lastname"] = $row["lastname"];
$overview[$row["active_fi"]]["title"] = $row["title"];
$overview[$row["active_fi"]]["login"] = $row["login"];
$overview[$row["active_fi"]]["usr_id"] = $row["usr_id"];
$overview[$row["active_fi"]]["started"] = $row["started"];
$overview[$row["active_fi"]]["finished"] = $row["finished"];
}
if (!array_key_exists($row["pass"], $overview[$row["active_fi"]]))
{
$overview[$row["active_fi"]][$row["pass"]] = array();
$overview[$row["active_fi"]][$row["pass"]]["reached"] = 0;
$overview[$row["active_fi"]][$row["pass"]]["maxpoints"] = $row["maxpoints"];
}
array_push($overview[$row["active_fi"]][$row["pass"]], $row);
$overview[$row["active_fi"]][$row["pass"]]["reached"] += $row["points"];
}
return $overview;
}
Here is the caller graph for this function:| ilObjTest::_getActiveIdOfUser | ( | $ | user_id = "", |
|
| $ | test_id = "" | |||
| ) |
Gets the active id of the tst_active table for the active user.
Gets the active id of the tst_active table for the active user
| integer | $user_id The database id of the user | |
| integer | $test_id The database id of the test |
Definition at line 3687 of file class.ilObjTest.php.
References $test_id.
Referenced by ilSoapTestAdministration::saveQuestionResult().
{
global $ilDB;
global $ilUser;
if (!$user_id) {
$user_id = $ilUser->id;
}
if (!$test_id)
{
return "";
}
$query = sprintf("SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
$ilDB->quote($user_id . ""),
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["active_id"];
}
else
{
return "";
}
}
Here is the caller graph for this function:| & ilObjTest::_getArrayData | ( | $ | query, | |
| $ | id_field | |||
| ) |
Definition at line 7183 of file class.ilObjTest.php.
Referenced by _getSolvedQuestions(), and getArrayData().
{
global $ilDB;
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$result_array[$row->$id_field]= $row;
}
return ($result_array)?$result_array:array();
}
Here is the caller graph for this function:| & ilObjTest::_getAvailableTests | ( | $ | use_object_id = FALSE |
) |
Returns the available tests for the active user.
Returns the available tests for the active user
Definition at line 6531 of file class.ilObjTest.php.
References ilUtil::_getObjectsByOperations(), and ilObject::_prepareCloneSelection().
Referenced by ilObjAssessmentFolderGUI::logAdminObject(), and ilObjAssessmentFolderGUI::logsObject().
{
global $ilUser;
global $ilDB;
$result_array = array();
$tests = ilUtil::_getObjectsByOperations("tst","write", $ilUser->getId(), -1);
if (count($tests))
{
$titles = ilObject::_prepareCloneSelection($tests, "tst");
$query = sprintf("SELECT object_data.*, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') ORDER BY object_data.title",
implode("','", $tests)
);
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($use_object_id)
{
$result_array[$row["obj_id"]] = $titles[$row["ref_id"]];
}
else
{
$result_array[$row["ref_id"]] = $titles[$row["ref_id"]];
}
}
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getBestPass | ( | $ | active_id | ) |
Retrieves the best pass of a given user for a given test.
Retrieves the best pass of a given user for a given test
| integer | $user_id The user id | |
| integer | $test_id The test id |
Definition at line 7522 of file class.ilObjTest.php.
References $results, $test_id, and _getCompleteEvaluationData().
Referenced by _getResultPass().
{
global $ilDB;
$query = sprintf("SELECT test_fi FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$test_id = $row["test_fi"];
$results =& ilObjTest::_getCompleteEvaluationData($test_id, FALSE, $active_id);
$participant =& $results->getParticipant($active_id);
if ($participant != null)
{
return $participant->getBestPass();
}
else
{
return 0;
}
}
else
{
return 0;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::_getCompleteEvaluationData | ( | $ | test_id, | |
| $ | withStatistics = TRUE, |
|||
| $ | active_id = "" | |||
| ) |
Definition at line 4631 of file class.ilObjTest.php.
References $data, $mark_schema, $test_id, _buildName(), _getCompleteWorkingTimeOfParticipants(), _getECTSGrade(), _getQuestionCount(), and _getVisitTimeOfParticipant().
Referenced by _getBestPass(), ilObjTestAccess::_getPassedUsers(), _getPassedUsers(), and ilObjTestAccess::_isPassed().
{
global $ilDB;
$testquery = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_id . "")
);
$testres = $ilDB->query($testquery);
$testdata = array();
if ($testres->numRows())
{
$testdata = $testres->fetchRow(DB_FETCHMODE_ASSOC);
}
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$mark_schema = new ASS_MarkSchema();
$mark_schema->loadFromDb($test_id);
include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
if ($active_id > 0) $withStatistics = FALSE;
$data = new ilTestEvaluationData();
if ($active_id > 0)
{
$query = sprintf("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_test_result.*, qpl_questions.original_id, qpl_questions.title AS questiontitle, " .
"qpl_questions.points AS maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
"ORDER BY active_id, pass, TIMESTAMP",
$ilDB->quote($test_id . ""),
$ilDB->quote($active_id . "")
);
}
else
{
$query = sprintf("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_test_result.*, qpl_questions.original_id, qpl_questions.title AS questiontitle, " .
"qpl_questions.points AS maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s " .
"ORDER BY active_id, pass, TIMESTAMP",
$ilDB->quote($test_id . "")
);
}
$result = $ilDB->query($query);
$pass = NULL;
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if (!$data->participantExists($row["active_fi"]))
{
$data->addParticipant($row["active_fi"], new ilTestEvaluationUserData());
$data->getParticipant($row["active_fi"])->setName(ilObjTest::_buildName($testdata["anonymity"], $row["usr_id"], $row["firstname"], $row["lastname"], $row["title"]));
$data->getParticipant($row["active_fi"])->setLogin($row["login"]);
$data->getParticipant($row["active_fi"])->setUserID($row["usr_id"]);
}
if (!is_object($data->getParticipant($row["active_fi"])->getPass($row["pass"])))
{
$pass = new ilTestEvaluationPassData();
$pass->setPass($row["pass"]);
$data->getParticipant($row["active_fi"])->addPass($row["pass"], $pass);
}
$data->getParticipant($row["active_fi"])->getPass($row["pass"])->addAnsweredQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["maxpoints"], $row["points"]);
}
foreach (array_keys($data->getParticipants()) as $active_id)
{
if ($testdata["random_test"])
{
for ($testpass = 0; $testpass <= $data->getParticipant($active_id)->getLastPass(); $testpass++)
{
$query = sprintf("SELECT tst_test_random_question.sequence, tst_test_random_question.question_fi, qpl_questions.original_id, " .
"tst_test_random_question.pass, qpl_questions.points, qpl_questions.title " .
"FROM tst_test_random_question, qpl_questions " .
"WHERE tst_test_random_question.question_fi = qpl_questions.question_id " .
"AND tst_test_random_question.pass = %s " .
"AND tst_test_random_question.active_fi = %s ORDER BY tst_test_random_question.sequence LIMIT 0, %s",
$ilDB->quote($testpass . ""),
$ilDB->quote($active_id . ""),
ilObjTest::_getQuestionCount($test_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$tpass = array_key_exists("pass", $row) ? $row["pass"] : 0;
$data->getParticipant($active_id)->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $tpass);
$data->addQuestionTitle($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["title"]);
}
}
}
}
else
{
$query = sprintf("SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
"qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
"FROM tst_test_question, tst_active, qpl_questions " .
"WHERE tst_test_question.question_fi = qpl_questions.question_id " .
"AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$questionsbysequence = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$questionsbysequence[$row["sequence"]] = $row;
}
$sequery = sprintf("SELECT * FROM tst_sequence WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$seqresult = $ilDB->query($sequery);
while ($seqrow = $seqresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$questionsequence = unserialize($seqrow["sequence"]);
foreach ($questionsequence as $sidx => $seq)
{
$qsid = $questionsbysequence[$seq]["original_id"] ? $questionsbysequence[$seq]["original_id"] : $questionsbysequence[$seq]["question_fi"];
$data->getParticipant($active_id)->addQuestion($qsid, $questionsbysequence[$seq]["points"], $sidx + 1, $seqrow["pass"]);
$data->addQuestionTitle($qsid, $questionsbysequence[$seq]["title"]);
}
}
/*
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$tpass = array_key_exists("pass", $row) ? $row["pass"] : 0;
$data->getParticipant($active_id)->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $tpass);
$data->addQuestionTitle($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["title"]);
}
*/
}
}
}
$workingTimes =& ilObjTest::_getCompleteWorkingTimeOfParticipants($test_id);
foreach (array_keys($data->getParticipants()) as $active_id)
{
$tpass = 0;
if ($testdata["pass_scoring"] == SCORE_BEST_PASS)
{
$tpass = $data->getParticipant($active_id)->getBestPass();
}
else
{
$tpass = $data->getParticipant($active_id)->getLastPass();
}
$data->getParticipant($active_id)->setReached($data->getParticipant($active_id)->getReachedPoints($tpass));
$data->getParticipant($active_id)->setMaxPoints($data->getParticipant($active_id)->getAvailablePoints($tpass));
$percentage = $data->getParticipant($active_id)->getMaxPoints() ? $data->getParticipant($active_id)->getReached() / $data->getParticipant($active_id)->getMaxPoints() * 100.0 : 0;
$mark = $mark_schema->getMatchingMark($percentage);
if (is_object($mark))
{
$data->getParticipant($active_id)->setMark($mark->getShortName());
$data->getParticipant($active_id)->setMarkOfficial($mark->getOfficialName());
$data->getParticipant($active_id)->setPassed($mark->getPassed());
}
if (is_object($data->getParticipant($active_id)->getPass($tpass)))
{
$data->getParticipant($active_id)->setQuestionsWorkedThrough($data->getParticipant($active_id)->getPass($tpass)->getAnsweredQuestionCount());
}
$questionpass = $tpass;
if (!is_array($data->getParticipant($active_id)->getQuestions($tpass)))
{
$questionpass = 0;
}
$data->getParticipant($active_id)->setNumberOfQuestions(count($data->getParticipant($active_id)->getQuestions($questionpass)));
$data->getParticipant($active_id)->setTimeOfWork($workingTimes[$active_id]);
$visitingTime =& ilObjTest::_getVisitTimeOfParticipant($test_id, $active_id);
$data->getParticipant($active_id)->setFirstVisit($visitingTime["firstvisit"]);
$data->getParticipant($active_id)->setLastVisit($visitingTime["lastvisit"]);
}
$passed_points = array();
foreach (array_keys($data->getParticipants()) as $active_id)
{
$participant =& $data->getParticipant($active_id);
if ($participant->getPassed())
{
array_push($passed_points, $participant->getReached());
}
}
foreach (array_keys($data->getParticipants()) as $active_id)
{
$participant =& $data->getParticipant($active_id);
if ($testdata["ects_output"])
{
$ects_mark = ilObjTest::_getECTSGrade($passed_points, $participant->getReached(), $participant->getMaxPoints(), $testdata["ects_a"], $testdata["ects_b"], $testdata["ects_c"], $testdata["ects_d"], $testdata["ects_e"], $testdata["ects_fx"]);
$participant->setECTSMark($ects_mark);
}
}
if ($withStatistics)
{
$data->calculateStatistics();
}
return $data;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::_getCompleteWorkingTimeOfParticipants | ( | $ | test_id | ) |
Returns the complete working time in seconds for all test participants.
Returns the complete working time in seconds for all test participants
| integer | $test_id The database ID of the test |
Definition at line 3941 of file class.ilObjTest.php.
References $test_id.
Referenced by _getCompleteEvaluationData(), and getCompleteWorkingTimeOfParticipants().
{
global $ilDB;
$query = sprintf("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",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
$time = 0;
$times = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if (!array_key_exists($row["active_fi"], $times))
{
$times[$row["active_fi"]] = 0;
}
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$times[$row["active_fi"]] += ($epoch_2 - $epoch_1);
}
return $times;
}
Here is the caller graph for this function:| ilObjTest::_getCountSystem | ( | $ | active_id | ) |
Gets the count system for the calculation of points.
Gets the count system for the calculation of points
Definition at line 2345 of file class.ilObjTest.php.
Referenced by assQuestion::calculateReachedPoints().
{
global $ilDB;
$query = sprintf("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",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["count_system"];
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::_getECTSGrade | ( | $ | points_passed, | |
| $ | reached_points, | |||
| $ | max_points, | |||
| $ | a, | |||
| $ | b, | |||
| $ | c, | |||
| $ | d, | |||
| $ | e, | |||
| $ | fx | |||
| ) |
Returns the ECTS grade for a number of reached points.
Returns the ECTS grade for a number of reached points
| double | $reached_points The points reached in the test | |
| double | $max_points The maximum number of points for the test |
Definition at line 6327 of file class.ilObjTest.php.
References $d.
Referenced by _getCompleteEvaluationData(), and getECTSGrade().
{
include_once "./classes/class.ilStatistics.php";
// calculate the median
$passed_statistics = new ilStatistics();
$passed_statistics->setData($points_passed);
$ects_percentiles = array
(
"A" => $passed_statistics->quantile($a),
"B" => $passed_statistics->quantile($b),
"C" => $passed_statistics->quantile($c),
"D" => $passed_statistics->quantile($d),
"E" => $passed_statistics->quantile($e)
);
if (count($points_passed) && ($reached_points >= $ects_percentiles["A"]))
{
return "A";
}
else if (count($points_passed) && ($reached_points >= $ects_percentiles["B"]))
{
return "B";
}
else if (count($points_passed) && ($reached_points >= $ects_percentiles["C"]))
{
return "C";
}
else if (count($points_passed) && ($reached_points >= $ects_percentiles["D"]))
{
return "D";
}
else if (count($points_passed) && ($reached_points >= $ects_percentiles["E"]))
{
return "E";
}
else if (strcmp($fx, "") != 0)
{
if ($max_points > 0)
{
$percentage = ($reached_points / $max_points) * 100.0;
if ($percentage < 0) $percentage = 0.0;
}
else
{
$percentage = 0.0;
}
if ($percentage >= $fx)
{
return "FX";
}
else
{
return "F";
}
}
else
{
return "F";
}
}
Here is the caller graph for this function:| ilObjTest::_getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 892 of file class.ilObjTest.php.
References ilUtil::getDataDir().
Referenced by assTextSubsetImport::fromXML(), assTextQuestionImport::fromXML(), assSingleChoiceImport::fromXML(), assOrderingQuestionImport::fromXML(), assNumericImport::fromXML(), assMultipleChoiceImport::fromXML(), assMatchingQuestionImport::fromXML(), assJavaAppletImport::fromXML(), assImagemapQuestionImport::fromXML(), assClozeTestImport::fromXML(), ilObjTestGUI::importVerifiedFileObject(), and ilObjTestGUI::uploadTstObject().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$import_dir = ilUtil::getDataDir()."/tst_data/tst_import";
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getLastAccess | ( | $ | active_id | ) |
Definition at line 8584 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["finished"];
}
return "";
}
| ilObjTest::_getMaxPass | ( | $ | active_id | ) |
Retrieves the maximum pass of a given user for a given test.
Retrieves the maximum pass of a given user for a given test in which the user answered at least one question
| integer | $user_id The user id | |
| integer | $test_id The test id |
Definition at line 7493 of file class.ilObjTest.php.
Referenced by _getResultPass().
{
global $ilDB;
$query = sprintf("SELECT MAX(pass) as maxpass FROM tst_test_result WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$max = $row["maxpass"];
}
else
{
$max = NULL;
}
return $max;
}
Here is the caller graph for this function:| ilObjTest::_getMCScoring | ( | $ | active_id | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 2449 of file class.ilObjTest.php.
Referenced by assMultipleChoice::calculateReachedPoints().
{
global $ilDB;
$query = sprintf("SELECT tst_tests.mc_scoring FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["mc_scoring"];
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::_getObjectIDFromActiveID | ( | $ | active_id | ) |
Returns the ILIAS test object id for a given active id.
Returns the ILIAS test object id for a given active id
| integer | $active_id The active id |
Definition at line 6915 of file class.ilObjTest.php.
Referenced by assQuestion::_logAction(), and assQuestion::logAction().
{
global $ilDB;
$object_id = FALSE;
$query = sprintf("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",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$object_id = $row["obj_fi"];
}
return $object_id;
}
Here is the caller graph for this function:| ilObjTest::_getObjectIDFromTestID | ( | $ | test_id | ) |
Returns the ILIAS test object id for a given test id.
Returns the ILIAS test object id for a given test id
| integer | $test_id The test id |
Definition at line 6890 of file class.ilObjTest.php.
References $test_id.
Referenced by assJavaAppletGUI::getSolutionOutput(), assJavaAppletGUI::getTestOutput(), and ASS_MarkSchema::logAction().
{
global $ilDB;
$object_id = FALSE;
$query = sprintf("SELECT obj_fi FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$object_id = $row["obj_fi"];
}
return $object_id;
}
Here is the caller graph for this function:| ilObjTest::_getPass | ( | $ | active_id | ) |
Retrieves the actual pass of a given user for a given test.
Retrieves the actual pass of a given user for a given test
| integer | $user_id The user id | |
| integer | $test_id The test id |
Definition at line 7464 of file class.ilObjTest.php.
Referenced by assFlashAppGUI::createTmpData(), getAllQuestions(), assJavaAppletGUI::getSolutionOutput(), assImagemapQuestionGUI::getSolutionOutput(), getStartingTimeOfUser(), getStartTestLabel(), assTextSubsetGUI::getTestOutput(), assTextQuestionGUI::getTestOutput(), assSingleChoiceGUI::getTestOutput(), assOrderingQuestionGUI::getTestOutput(), assNumericGUI::getTestOutput(), assMultipleChoiceGUI::getTestOutput(), assMatchingQuestionGUI::getTestOutput(), assJavaAppletGUI::getTestOutput(), assImagemapQuestionGUI::getTestOutput(), assClozeTestGUI::getTestOutput(), getTestResult(), isExecutable(), loadQuestions(), assImagemapQuestionGUI::outQuestionForTest(), assTextSubset::saveWorkingData(), assTextQuestion::saveWorkingData(), assSingleChoice::saveWorkingData(), assQuestionTypeTemplate::saveWorkingData(), assQuestion::saveWorkingData(), assOrderingQuestion::saveWorkingData(), assNumeric::saveWorkingData(), assMultipleChoice::saveWorkingData(), assMatchingQuestion::saveWorkingData(), assImagemapQuestion::saveWorkingData(), and assClozeTest::saveWorkingData().
{
global $ilDB;
$query = sprintf("SELECT tries FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["tries"];
}
else
{
return 0;
}
}
Here is the caller graph for this function:| & ilObjTest::_getPassedUsers | ( | $ | a_obj_id | ) |
Returns an array containing the user ids of all users who passed the test.
Returns an array containing the user ids of all users who passed the test, regardless if they fnished the test with the finish test button or not. Only the reached points are counted
| integer | $test_id Test id of the test |
Definition at line 8422 of file class.ilObjTest.php.
References $results, $test_id, _getCompleteEvaluationData(), and _getTestIDFromObjectID().
{
$passed_users = array();
$test_id = ilObjTest::_getTestIDFromObjectID($a_obj_id);
$results =& ilObjTest::_getCompleteEvaluationData($test_id, FALSE);
if (is_object($results))
{
$participants =& $results->getParticipants();
foreach ($participants as $active_id => $participant)
{
if (is_object($participant) && $participant->getPassed())
{
array_push($passed_users, $active_id);
}
}
}
return $passed_users;
}
Here is the call graph for this function:| ilObjTest::_getPassScoring | ( | $ | active_id | ) |
Gets the pass scoring type.
Gets the pass scoring type
Definition at line 2425 of file class.ilObjTest.php.
Referenced by _getResultPass().
{
global $ilDB;
$query = sprintf("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",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["pass_scoring"];
}
return 0;
}
Here is the caller graph for this function:| ilObjTest::_getQuestionCount | ( | $ | test_id | ) |
Returns the number of questions in the test for a given user.
Returns the number of questions in the test for a given user
Definition at line 6744 of file class.ilObjTest.php.
References $data, and $test_id.
Referenced by _getCompleteEvaluationData(), and saveRandomQuestionpools().
{
global $ilDB;
$num = 0;
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if (!$result->numRows())
{
return 0;
}
$test = $result->fetchRow(DB_FETCHMODE_ASSOC);
if ($test["random_test"] == 1)
{
$qpls = array();
$counter = 0;
$query = sprintf("SELECT * FROM tst_test_random WHERE test_fi = %s ORDER BY test_random_id",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$countquery = sprintf("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND original_id IS NULL",
$ilDB->quote($row["questionpool_fi"] . "")
);
$countresult = $ilDB->query($countquery);
$contains = $countresult->numRows();
$qpls[$counter] = array(
"index" => $counter,
"count" => $row["num_of_q"],
"qpl" => $row["questionpool_fi"],
"contains" => $contains
);
$counter++;
}
}
if ($test["random_question_count"] > 0)
{
$num = $test["random_question_count"];
$maxcount = 0;
foreach ($qpls as $data)
{
$maxcount += $data["contains"];
}
if ($num > $maxcount) $num = $maxcount;
}
else
{
$num = 0;
foreach ($qpls as $data)
{
$add = ($data["count"] <= $data["contains"]) ? $data["count"] : $data["contains"];
$num += $add;
}
}
}
else
{
$query = sprintf("SELECT test_question_id FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
$num = $result->numRows();
}
return $num;
}
Here is the caller graph for this function:| ilObjTest::_getRefIdFromObjId | ( | $ | obj_id | ) |
Definition at line 6677 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("SELECT ref_id FROM object_reference WHERE obj_id=%s",
$ilDB->quote($obj_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["ref_id"];
}
return 0;
}
| ilObjTest::_getResultPass | ( | $ | active_id | ) |
Retrieves the pass number that should be counted for a given user.
Retrieves the pass number that should be counted for a given user
| integer | $user_id The user id | |
| integer | $test_id The test id |
Definition at line 7560 of file class.ilObjTest.php.
References _getBestPass(), _getMaxPass(), and _getPassScoring().
Referenced by canShowCertificate(), evalStatistical(), ilTestCertificateGUI::outCertificate(), and ilTestOutputGUI::outParticipantsResultsOverview().
{
$counted_pass = NULL;
if (ilObjTest::_getPassScoring($active_id) == SCORE_BEST_PASS)
{
$counted_pass = ilObjTest::_getBestPass($active_id);
}
else
{
$counted_pass = ilObjTest::_getMaxPass($active_id);
}
return $counted_pass;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getScoreCutting | ( | $ | active_id | ) |
Determines if the score of a question should be cut at 0 points or the score of the whole test.
Determines if the score of a question should be cut at 0 points or the score of the whole test
Definition at line 2473 of file class.ilObjTest.php.
Referenced by assQuestion::calculateReachedPoints().
{
global $ilDB;
$query = sprintf("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",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["score_cutting"];
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::_getSolvedQuestions | ( | $ | active_id, | |
| $ | question_fi = null | |||
| ) |
get solved questions
Definition at line 7321 of file class.ilObjTest.php.
References _getArrayData().
Referenced by ilTestSequence::getSequenceSummary(), ilTestOutputGUI::outQuestionSummary(), and ilTestOutputGUI::outWorkingForm().
{
global $ilDB;
if (is_numeric($question_fi))
$query = sprintf("SELECT question_fi, solved FROM tst_active_qst_sol_settings " .
"WHERE active_fi = %s AND question_fi=%s",
$ilDB->quote($active_id),
$question_fi
);
else $query = sprintf("SELECT question_fi, solved FROM tst_active_qst_sol_settings " .
"WHERE active_fi = %s",
$ilDB->quote($active_id)
);
return ilObjTest::_getArrayData ($query, "question_fi");
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getTestIDFromObjectID | ( | $ | object_id | ) |
Returns the ILIAS test id for a given object id.
Returns the ILIAS test id for a given object id
| integer | $object_id The object id |
Definition at line 6940 of file class.ilObjTest.php.
References $test_id.
Referenced by _getPassedUsers().
{
global $ilDB;
$test_id = FALSE;
$query = sprintf("SELECT test_id FROM tst_tests WHERE obj_fi = %s",
$ilDB->quote($object_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$test_id = $row["test_id"];
}
return $test_id;
}
Here is the caller graph for this function:| ilObjTest::_getTitleOutput | ( | $ | active_id | ) |
Returns the value of the title_output status.
Returns the value of the title_output status
| integer | $active_id The active id of a user |
Definition at line 2554 of file class.ilObjTest.php.
Referenced by assQuestionGUI::outQuestionPage().
{
global $ilDB;
$query = sprintf("SELECT tst_tests.title_output FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["title_output"];
}
return 0;
}
Here is the caller graph for this function:| ilObjTest::_getUsePreviousAnswers | ( | $ | active_id, | |
| $ | user_active_user_setting = false | |||
| ) |
Returns if the previous results should be hidden for a learner.
Returns if the previous results should be hidden for a learner
| integer | $test_id The test id | |
| boolean | $use_active_user_setting If true, the tst_use_previous_answers- of the active user should be used as well |
Definition at line 2581 of file class.ilObjTest.php.
References $res, and $use_previous_answers.
Referenced by assFlashAppGUI::createTmpData(), assImagemapQuestionGUI::getSolutionOutput(), assTextSubsetGUI::getTestOutput(), assTextQuestionGUI::getTestOutput(), assSingleChoiceGUI::getTestOutput(), assOrderingQuestionGUI::getTestOutput(), assNumericGUI::getTestOutput(), assMultipleChoiceGUI::getTestOutput(), assMatchingQuestionGUI::getTestOutput(), assJavaAppletGUI::getTestOutput(), assImagemapQuestionGUI::getTestOutput(), assClozeTestGUI::getTestOutput(), and assImagemapQuestionGUI::outQuestionForTest().
{
global $ilDB;
global $ilUser;
$use_previous_answers = 1;
$query = sprintf("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",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$use_previous_answers = $row["use_previous_answers"];
}
if ($use_previous_answers == 1)
{
if ($user_active_user_setting)
{
$res = $ilUser->getPref("tst_use_previous_answers");
if ($res !== FALSE)
{
$use_previous_answers = $res;
}
}
}
return $use_previous_answers;
}
Here is the caller graph for this function:| ilObjTest::_getUserIdFromActiveId | ( | $ | active_id | ) |
Definition at line 8484 of file class.ilObjTest.php.
Referenced by assQuestion::_setReachedPoints(), removeSelectedTestResults(), and removeTestResultsForUser().
{
global $ilDB;
$query = sprintf("SELECT user_fi FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["user_fi"];
}
else
{
return -1;
}
}
Here is the caller graph for this function:| ilObjTest::_getVisitTimeOfParticipant | ( | $ | test_id, | |
| $ | active_id | |||
| ) |
Returns the first and last visit of a participant.
Returns the first and last visit of a participant
| integer | $test_id The database ID of the test | |
| integer | $active_id The active ID of the participant |
Definition at line 4019 of file class.ilObjTest.php.
References $test_id.
Referenced by _getCompleteEvaluationData(), and getVisitTimeOfParticipant().
{
global $ilDB;
$query = sprintf("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.started",
$ilDB->quote($test_id . ""),
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$firstvisit = 0;
$lastvisit = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
}
return array("firstvisit" => $firstvisit, "lastvisit" => $lastvisit);
}
Here is the caller graph for this function:| & ilObjTest::_instanciateQuestion | ( | $ | question_id | ) |
Creates an instance of a question with a given question id.
Creates an instance of a question with a given question id
| integer | $question_id The question id |
Definition at line 5321 of file class.ilObjTest.php.
References assQuestion::_getQuestionType().
Referenced by ilCourseObjectiveQuestion::__read(), cloneObject(), ilObjQuestionPool::deleteQuestion(), duplicateQuestionForTest(), getEstimatedWorkingTime(), ilCourseObjectiveQuestion::getMaxPointsByObjective(), ilCourseObjectiveQuestion::getMaxPointsByTest(), ilTestSequence::getSequenceSummary(), ilCourseObjectivesGUI::listAssignedQuestions(), ilCourseObjectivesGUI::listQuestionAssignment(), removeQuestion(), and toXML().
{
if (strcmp($question_id, "") != 0)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question_type = assQuestion::_getQuestionType($question_id);
if(!strlen($question_type))
{
return false;
}
include_once "./Modules/TestQuestionPool/classes/class.".$question_type.".php";
$question = new $question_type();
$question->loadFromDb($question_id);
return $question;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_isComplete | ( | $ | obj_id | ) |
Returns true, if a test is complete for use.
Returns true, if a test is complete for use
Definition at line 1026 of file class.ilObjTest.php.
References ilObjTest().
{
$test = new ilObjTest($obj_id, false);
$test->loadFromDb();
return $test->isComplete();
}
Here is the call graph for this function:| ilObjTest::_lookupAnonymity | ( | $ | a_obj_id | ) |
Returns the anonymity status of a test with a given object id.
Returns the anonymity status of a test with a given object id
| int | $a_obj_id The object id of the test object |
Definition at line 8890 of file class.ilObjTest.php.
References $res.
Referenced by ilLPListOfSettingsGUI::__checkItemAnonymized(), ilLPCollections::__read(), ilLPTestListGUI::__readAnonymized(), ilLPCollections::_getItems(), ilObjTestAccess::_getParticipantData(), assJavaAppletGUI::getSolutionOutput(), assJavaAppletGUI::getTestOutput(), ilLearningProgressBaseGUI::isObjectAnonymized(), and ilLPFilter::searchFilterListener().
{
global $ilDB;
$query = "SELECT anonymity FROM tst_tests ".
"WHERE obj_fi = '".$a_obj_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
return $row['anonymity'];
}
return 0;
}
Here is the caller graph for this function:| ilObjTest::_lookupAuthor | ( | $ | obj_id | ) |
Gets the authors name.
Gets the authors name of the ilObjTest object
Definition at line 6497 of file class.ilObjTest.php.
References $author, and ilObject::$id.
Referenced by assQuestion::getInstances().
{
$author = array();
include_once "./Services/MetaData/classes/class.ilMD.php";
$md =& new ilMD($obj_id, 0, "tst");
$md_life =& $md->getLifecycle();
if ($md_life)
{
$ids =& $md_life->getContributeIds();
foreach ($ids as $id)
{
$md_cont =& $md_life->getContribute($id);
if (strcmp($md_cont->getRole(), "Author") == 0)
{
$entids =& $md_cont->getEntityIds();
foreach ($entids as $entid)
{
$md_ent =& $md_cont->getEntity($entid);
array_push($author, $md_ent->getEntity());
}
}
}
}
return join($author, ",");
}
Here is the caller graph for this function:| ilObjTest::_lookupRandomTestFromActiveId | ( | $ | active_id | ) |
Returns the random status of a test with a given object id.
Returns the random status of a test with a given object id
| int | $a_obj_id The object id of the test object |
Definition at line 8913 of file class.ilObjTest.php.
References $res.
{
global $ilDB;
$query = sprintf("SELECT tst_tests.random_test FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
$ilDB->quote($active_id . "")
);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
return $row['random_test'];
}
return 0;
}
| ilObjTest::_lookupTestObjIdForQuestionId | ( | $ | a_q_id | ) |
Get test Object ID for question ID.
Definition at line 9412 of file class.ilObjTest.php.
Referenced by ilObjMediaObject::getParentObjectIdForUsage().
{
global $ilDB;
$set = $ilDB->query("SELECT t.obj_fi AS obj_id FROM tst_test_question AS q, tst_tests AS t WHERE".
" q.test_fi = t.test_id AND q.question_fi = ".$ilDB->quote($a_q_id));
$rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
return $rec["obj_id"];
}
Here is the caller graph for this function:| ilObjTest::addDefaults | ( | $ | a_name | ) |
Adds the defaults of this test to the test defaults.
Adds the defaults of this test to the test defaults
| string | $a_name The name of the test defaults public |
Definition at line 9074 of file class.ilObjTest.php.
References getAnonymity(), getAnswerFeedback(), getAnswerFeedbackPoints(), getCountSystem(), getECTSFX(), getECTSGrades(), getECTSOutput(), getEnableProcessingTime(), getEndingTime(), getInstantFeedbackSolution(), getIntroduction(), getListOfQuestionsSettings(), getMCScoring(), getNrOfTries(), getPassScoring(), getProcessingTime(), getRandomQuestionCount(), getReportingDate(), getResetProcessingTime(), getResultsPresentation(), getScoreReporting(), getSequenceSettings(), getShowCancel(), getShowMarker(), getStartingTime(), getTitleOutput(), getUsePreviousAnswers(), and isRandomTest().
{
global $ilDB;
global $ilUser;
$testsettings = array(
"TitleOutput" => $this->getTitleOutput(),
"PassScoring" => $this->getPassScoring(),
"Introduction" => $this->getIntroduction(),
"SequenceSettings" => $this->getSequenceSettings(),
"ScoreReporting" => $this->getScoreReporting(),
"InstantFeedbackSolution" => $this->getInstantFeedbackSolution(),
"AnswerFeedback" => $this->getAnswerFeedback(),
"AnswerFeedbackPoints" => $this->getAnswerFeedbackPoints(),
"ResultsPresentation" => $this->getResultsPresentation(),
"Anonymity" => $this->getAnonymity(),
"ShowCancel" => $this->getShowCancel(),
"ShowMarker" => $this->getShowMarker(),
"ReportingDate" => $this->getReportingDate(),
"NrOfTries" => $this->getNrOfTries(),
"UsePreviousAnswers" => $this->getUsePreviousAnswers(),
"ProcessingTime" => $this->getProcessingTime(),
"EnableProcessingTime" => $this->getEnableProcessingTime(),
"ResetProcessingTime" => $this->getResetProcessingTime(),
"StartingTime" => $this->getStartingTime(),
"EndingTime" => $this->getEndingTime(),
"ECTSOutput" => $this->getECTSOutput(),
"ECTSFX" => $this->getECTSFX(),
"ECTSGrades" => $this->getECTSGrades(),
"isRandomTest" => $this->isRandomTest(),
"RandomQuestionCount" => $this->getRandomQuestionCount(),
"CountSystem" => $this->getCountSystem(),
"MCScoring" => $this->getMCScoring(),
"ListOfQuestionsSettings" => $this->getListOfQuestionsSettings()
);
$query = sprintf("INSERT INTO tst_test_defaults (test_defaults_id, name, user_fi, defaults, marks) VALUES (NULL, %s, %s, %s, %s)",
$ilDB->quote($a_name . ""),
$ilDB->quote($ilUser->getId(). ""),
$ilDB->quote(serialize($testsettings)),
$ilDB->quote(serialize($this->mark_schema))
);
$result = $ilDB->query($query);
}
Here is the call graph for this function:| ilObjTest::addQTIMaterial | ( | &$ | a_xml_writer, | |
| $ | a_material | |||
| ) |
Creates a QTI material tag from a plain text or xhtml text.
| object | $a_xml_writer Reference to the ILIAS XML writer | |
| string | $a_material plain text or html text containing the material |
Definition at line 8660 of file class.ilObjTest.php.
References $mobs, ilObjMediaObject::_getMobsOfObject(), ilRTE::_replaceMediaObjectImageSrc(), ilObject::getId(), and isHTML().
Referenced by toXML().
{
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$a_xml_writer->xmlStartTag("material");
$attrs = array(
"texttype" => "text/plain"
);
if ($this->isHTML($a_material))
{
$attrs["texttype"] = "text/xhtml";
}
$a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
$mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->getId());
foreach ($mobs as $mob)
{
$mob_obj =& new ilObjMediaObject($mob);
$imgattrs = array(
"label" => "il_" . IL_INST_ID . "_mob_" . $mob,
"uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
);
$a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
}
$a_xml_writer->xmlEndTag("material");
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::applyDefaults | ( | $ | test_defaults_id | ) |
Applies given test defaults to this test.
Applies given test defaults to this test
| integer | $test_defaults_id The database id of the test defaults |
Definition at line 9126 of file class.ilObjTest.php.
References $total, evalTotalPersons(), getQuestionCount(), getTestDefaults(), saveToDb(), setAnonymity(), setAnswerFeedback(), setAnswerFeedbackPoints(), setCountSystem(), setECTSFX(), setECTSGrades(), setECTSOutput(), setEnableProcessingTime(), setEndingTime(), setInstantFeedbackSolution(), setIntroduction(), setListOfQuestionsSettings(), setMCScoring(), setNrOfTries(), setPassScoring(), setProcessingTime(), setRandomQuestionCount(), setRandomTest(), setReportingDate(), setResetProcessingTime(), setResultsPresentation(), setScoreReporting(), setSequenceSettings(), setShowCancel(), setShowMarker(), setStartingTime(), setTitleOutput(), and setUsePreviousAnswers().
{
$total = $this->evalTotalPersons();
$result = FALSE;
if (($this->getQuestionCount() == 0) && ($total == 0))
{
// only apply if there are no questions added and not user datasets exist
$defaults =& $this->getTestDefaults($test_defaults_id);
$testsettings = unserialize($defaults["defaults"]);
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$this->mark_schema = unserialize($defaults["marks"]);
$this->setTitleOutput($testsettings["TitleOutput"]);
$this->setPassScoring($testsettings["PassScoring"]);
$this->setIntroduction($testsettings["Introduction"]);
$this->setSequenceSettings($testsettings["SequenceSettings"]);
$this->setScoreReporting($testsettings["ScoreReporting"]);
$this->setInstantFeedbackSolution($testsettings["InstantFeedbackSolution"]);
$this->setAnswerFeedback($testsettings["AnswerFeedback"]);
$this->setAnswerFeedbackPoints($testsettings["AnswerFeedbackPoints"]);
$this->setResultsPresentation($testsettings["ResultsPresentation"]);
$this->setAnonymity($testsettings["Anonymity"]);
$this->setShowCancel($testsettings["ShowCancel"]);
$this->setShowMarker($testsettings["ShowMarker"]);
$this->setReportingDate($testsettings["ReportingDate"]);
$this->setNrOfTries($testsettings["NrOfTries"]);
$this->setUsePreviousAnswers($testsettings["UsePreviousAnswers"]);
$this->setProcessingTime($testsettings["ProcessingTime"]);
$this->setResetProcessingTime($testsettings["ResetProcessingTime"]);
$this->setEnableProcessingTime($testsettings["EnableProcessingTime"]);
$this->setStartingTime($testsettings["StartingTime"]);
$this->setEndingTime($testsettings["EndingTime"]);
$this->setECTSOutput($testsettings["ECTSOutput"]);
$this->setECTSFX($testsettings["ECTSFX"]);
$this->setECTSGrades($testsettings["ECTSGrades"]);
$this->setRandomTest($testsettings["isRandomTest"]);
$this->setRandomQuestionCount($testsettings["RandomQuestionCount"]);
$this->setCountSystem($testsettings["CountSystem"]);
$this->setMCScoring($testsettings["MCScoring"]);
$this->setListOfQuestionsSettings($testsettings["ListOfQuestionsSettings"]);
$this->saveToDb();
$result = TRUE;
}
return $result;
}
Here is the call graph for this function:| ilObjTest::buildName | ( | $ | user_id, | |
| $ | firstname, | |||
| $ | lastname, | |||
| $ | title | |||
| ) |
Builds a user name for the output.
Builds a user name for the output depending on test type and existence of the user
| int | $user_id The database ID of the user | |
| string | $firstname The first name of the user | |
| string | $lastname The last name of the user | |
| string | $title The title of the user |
Definition at line 4966 of file class.ilObjTest.php.
References ilObject::$title, and getAnonymity().
Referenced by getUnfilteredEvaluationData().
{
$name = "";
if (strlen($firstname.$lastname.$title) == 0)
{
$name = $this->lng->txt("deleted_user");
}
else
{
if ($user_id == ANONYMOUS_USER_ID)
{
$name = $lastname;
}
else
{
$name = trim($lastname . ", " . $firstname . " " . $title);
}
if ($this->getAnonymity())
{
$name = $this->lng->txt("anonymous");
}
}
return $name;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::canEditMarks | ( | ) |
Definition at line 7765 of file class.ilObjTest.php.
References $total, evalTotalPersons(), and getReportingDate().
{
$total = $this->evalTotalPersons();
if ($total > 0)
{
if ($this->getReportingDate())
{
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getReportingDate(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
return true;
}
}
}
return false;
}
else
{
return true;
}
}
Here is the call graph for this function:| ilObjTest::canShowCertificate | ( | $ | user_id, | |
| $ | active_id | |||
| ) |
Checks wheather the certificate button could be shown on the info page or not.
Checks wheather the certificate button could be shown on the info page or not
public
Definition at line 9429 of file class.ilObjTest.php.
References _getResultPass(), canShowTestResults(), getCertificateVisibility(), and getTestResult().
{
if ($this->canShowTestResults($user_id))
{
$counted_pass = ilObjTest::_getResultPass($active_id);
$result_array =& $this->getTestResult($active_id, $counted_pass);
include_once "./Modules/Test/classes/class.ilTestCertificate.php";
$cert = new ilTestCertificate($this);
if ($cert->isComplete())
{
$vis = $this->getCertificateVisibility();
$showcert = FALSE;
switch ($vis)
{
case 0:
$showcert = TRUE;
break;
case 1:
if ($result_array["test"]["passed"] == 1)
{
$showcert = TRUE;
}
break;
case 2:
$showcert = FALSE;
break;
}
if ($showcert)
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
Here is the call graph for this function:| ilObjTest::canShowSolutionPrintview | ( | $ | user_id = NULL |
) |
Calculates if a user may see the solution printview of his/her test results.
Calculates if a user may see the solution printview of his/her test results
Definition at line 8314 of file class.ilObjTest.php.
References getShowSolutionPrintview().
{
return $this->getShowSolutionPrintview();
}
Here is the call graph for this function:| ilObjTest::canShowTestResults | ( | $ | user_id | ) |
Definition at line 7740 of file class.ilObjTest.php.
References $starting_time, canViewResults(), endingTimeReached(), getActiveIdOfUser(), getScoreReporting(), getStartingTimeOfUser(), getTestSession(), isMaxProcessingTimeReached(), and isTestFinishedToViewResults().
Referenced by canShowCertificate().
{
$active_id = $this->getActiveIdOfUser($user_id);
if ($active_id > 0)
{
$starting_time = $this->getStartingTimeOfUser($active_id);
}
$notimeleft = FALSE;
if ($starting_time !== FALSE)
{
if ($this->isMaxProcessingTimeReached($starting_time))
{
$notimeleft = TRUE;
}
}
$result = TRUE;
if (!$this->isTestFinishedToViewResults($active_id, $this->getTestSession($active_id)->getPass()) && ($this->getScoreReporting() == REPORT_AFTER_TEST))
{
$result = FALSE;
}
if (($this->endingTimeReached()) || $notimeleft) $result = TRUE;
$result = $result & $this->canViewResults();
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::canViewResults | ( | ) |
Returns true, if the test results can be viewed.
Returns true, if the test results can be viewed
Definition at line 7722 of file class.ilObjTest.php.
References getReportingDate().
Referenced by canShowTestResults().
{
$result = true;
if ($this->getReportingDate())
{
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getReportingDate(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
$result = false;
}
}
}
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::checkMarks | ( | ) |
Definition at line 6387 of file class.ilObjTest.php.
{
return $this->mark_schema->checkMarks();
}
| ilObjTest::checkMaximumAllowedUsers | ( | ) |
Definition at line 8551 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), getAllowedUsers(), getAllowedUsersTimeGap(), getTestId(), and logAction().
{
global $ilDB;
$nr_of_users = $this->getAllowedUsers();
$time_gap = ($this->getAllowedUsersTimeGap()) ? $this->getAllowedUsersTimeGap() : 60;
if (($nr_of_users > 0) && ($time_gap > 0))
{
$now = mktime();
$time_border = $now - $time_gap;
$str_time_border = strftime("%Y%m%d%H%M%S", $time_border);
$query = sprintf("SELECT DISTINCT tst_times.active_fi FROM tst_times, tst_active WHERE tst_times.TIMESTAMP > %s AND tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
$ilDB->quote($str_time_border),
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows() >= $nr_of_users)
{
include_once "./classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_could_not_enter_test_due_to_simultaneous_users", ilObjAssessmentFolder::_getLogLanguage()));
}
return FALSE;
}
else
{
return TRUE;
}
}
return TRUE;
}
Here is the call graph for this function:| ilObjTest::cleanupMediaobjectUsage | ( | ) |
Cleans up the media objects for all text fields in a test which are using an RTE field.
Cleans up the media objects for all text fields in a test which are using an RTE field
private
Definition at line 1116 of file class.ilObjTest.php.
References ilRTE::_cleanupMediaObjectUsage(), getAllRTEContent(), ilObject::getId(), and ilObject::getType().
Referenced by saveToDb().
{
include_once("./Services/RTE/classes/class.ilRTE.php");
$completecontent = "";
foreach ($this->getAllRTEContent() as $content)
{
$completecontent .= $content;
}
ilRTE::_cleanupMediaObjectUsage($completecontent, $this->getType() . ":html",
$this->getId());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::cloneObject | ( | $ | a_target_id, | |
| $ | a_copy_id = 0 | |||
| ) |
Clone object.
public
| int | ref id of parent container | |
| int | copy id |
Reimplemented from ilObject.
Definition at line 6601 of file class.ilObjTest.php.
References $ilLog, ilCopyWizardOptions::_getInstance(), assQuestion::_getOriginalId(), _instanciateQuestion(), ilObject::cloneMetaData(), cloneRandomQuestions(), getAnonymity(), getAnswerFeedback(), getAnswerFeedbackPoints(), getAuthor(), getCountSystem(), getECTSFX(), getECTSGrades(), getECTSOutput(), getEnableProcessingTime(), getEndingTime(), getFixedParticipants(), getInstantFeedbackSolution(), getIntroduction(), getListOfQuestionsSettings(), getMCScoring(), getNrOfTries(), getPassScoring(), getPassword(), getProcessingTime(), getRandomQuestionCount(), getRandomTest(), ilObject::getRefId(), getReportingDate(), getResetProcessingTime(), getResultsPresentation(), getScoreCutting(), getScoreReporting(), getSequenceSettings(), getShowCancel(), getShowMarker(), getShuffleQuestions(), getStartingTime(), getTitleOutput(), getUsePreviousAnswers(), isRandomTest(), and loadFromDb().
{
global $ilDB,$ilLog;
$this->loadFromDb();
// Copy settings
$newObj = parent::cloneObject($a_target_id,$a_copy_id);
$this->cloneMetaData($newObj);
$newObj->setAnonymity($this->getAnonymity());
$newObj->setAnswerFeedback($this->getAnswerFeedback());
$newObj->setAnswerFeedbackPoints($this->getAnswerFeedbackPoints());
$newObj->setAuthor($this->getAuthor());
$newObj->setCountSystem($this->getCountSystem());
$newObj->setECTSFX($this->getECTSFX());
$newObj->setECTSGrades($this->getECTSGrades());
$newObj->setECTSOutput($this->getECTSOutput());
$newObj->setEnableProcessingTime($this->getEnableProcessingTime());
$newObj->setEndingTime($this->getEndingTime());
$newObj->setFixedParticipants($this->getFixedParticipants());
$newObj->setInstantFeedbackSolution($this->getInstantFeedbackSolution());
$newObj->setIntroduction($this->getIntroduction());
$newObj->setListOfQuestionsSettings($this->getListOfQuestionsSettings());
$newObj->setMCScoring($this->getMCScoring());
$newObj->setNrOfTries($this->getNrOfTries());
$newObj->setPassScoring($this->getPassScoring());
$newObj->setPassword($this->getPassword());
$newObj->setProcessingTime($this->getProcessingTime());
$newObj->setRandomQuestionCount($this->getRandomQuestionCount());
$newObj->setRandomTest($this->getRandomTest());
$newObj->setReportingDate($this->getReportingDate());
$newObj->setResetProcessingTime($this->getResetProcessingTime());
$newObj->setResultsPresentation($this->getResultsPresentation());
$newObj->setScoreCutting($this->getScoreCutting());
$newObj->setScoreReporting($this->getScoreReporting());
$newObj->setSequenceSettings($this->getSequenceSettings());
$newObj->setShowCancel($this->getShowCancel());
$newObj->setShowMarker($this->getShowMarker());
$newObj->setShuffleQuestions($this->getShuffleQuestions());
$newObj->setStartingTime($this->getStartingTime());
$newObj->setTitleOutput($this->getTitleOutput());
$newObj->setUsePreviousAnswers($this->getUsePreviousAnswers());
$newObj->mark_schema = clone $this->mark_schema;
$newObj->saveToDb();
if ($this->isRandomTest())
{
$newObj->saveRandomQuestionCount($newObj->getRandomQuestionCount());
$this->cloneRandomQuestions($newObj->getTestId());
}
else
{
include_once("./Services/CopyWizard/classes/class.ilCopyWizardOptions.php");
$cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
// clone the questions
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
foreach ($this->questions as $key => $question_id)
{
$question = ilObjTest::_instanciateQuestion($question_id);
$newObj->questions[$key] = $question->duplicate();
$original_id = assQuestion::_getOriginalId($question_id);
$question = ilObjTest::_instanciateQuestion($newObj->questions[$key]);
$question->saveToDb($original_id);
// Save the mapping of old question id <-> new question id
// This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
$cwo->appendMapping($this->getRefId().'_'.$question_id,$newObj->getRefId().'_'.$newObj->questions[$key]);
$ilLog->write(__METHOD__.': Added mapping '.$this->getRefId().'_'.$question_id.' <-> ' .
$newObj->getRefId().'_'.$newObj->questions[$key]);
}
}
$newObj->saveToDb();
return $newObj;
}
Here is the call graph for this function:| ilObjTest::cloneRandomQuestions | ( | $ | new_id | ) |
Duplicates the source random questionpools for another test.
Duplicates the source random questionpools for another test
| integer | $new_id Test id of the new test which should take the random questionpools public |
Definition at line 6568 of file class.ilObjTest.php.
Referenced by cloneObject().
{
global $ilDB;
if ($new_id > 0)
{
$query = sprintf("SELECT * FROM tst_test_random WHERE test_fi = %s",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$query = sprintf("INSERT INTO tst_test_random (test_random_id, test_fi, questionpool_fi, num_of_q, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$ilDB->quote($new_id . ""),
$ilDB->quote($row["questionpool_fi"] . ""),
$ilDB->quote($row["num_of_q"] . "")
);
$insertresult = $ilDB->query($query);
}
}
}
}
Here is the caller graph for this function:| ilObjTest::create | ( | $ | a_upload = false |
) |
create test object
Definition at line 492 of file class.ilObjTest.php.
References ilObject::create(), and createMetaData().
{
parent::create();
// meta data will be created by
// import parser
if (!$a_upload)
{
$this->createMetaData();
}
}
Here is the call graph for this function:| 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 769 of file class.ilObjTest.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$this->ilias->raiseError("Test Data Directory (".$tst_data_dir
.") not writeable.",$this->ilias->error_obj->MESSAGE);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$tst_dir = $tst_data_dir."/tst_".$this->getId();
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$this->ilias->raiseError("Creation of Test Directory failed.",$this->ilias->error_obj->MESSAGE);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
$export_dir = $tst_dir."/export";
ilUtil::makeDir($export_dir);
if(!@is_dir($export_dir))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->MESSAGE);
}
}
Here is the call graph for this function:| ilObjTest::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)
Definition at line 911 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$this->ilias->raiseError("Test Data Directory (".$tst_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create test directory (data_dir/tst_data/tst_import)
$tst_dir = $tst_data_dir."/tst_import";
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$ilias->raiseError("Creation of test import directory failed.",$ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:| ilObjTest::createMetaData | ( | ) |
Create meta data entry.
Create meta data entry
public
Reimplemented from ilObject.
Definition at line 6447 of file class.ilObjTest.php.
References saveAuthorToMetadata().
Referenced by create().
{
parent::createMetaData();
$this->saveAuthorToMetadata();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::createNewAccessCode | ( | ) |
Returns a new, unused test access code.
Definition at line 8446 of file class.ilObjTest.php.
References isAccessCodeUsed().
{
// create a 5 character code
$codestring = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
mt_srand();
$code = "";
for ($i = 1; $i <=5; $i++)
{
$index = mt_rand(0, strlen($codestring)-1);
$code .= substr($codestring, $index, 1);
}
// verify it against the database
while ($this->isAccessCodeUsed($code))
{
$code = $this->createNewAccessCode();
}
return $code;
}
Here is the call graph for this function:| & ilObjTest::createQuestionGUI | ( | $ | question_type, | |
| $ | question_id = -1 | |||
| ) |
Creates a question GUI instance of a given question type.
Creates a question GUI instance of a given question type
| integer | $question_type The question type of the question | |
| integer | $question_id The question id of the question, if available |
Definition at line 5296 of file class.ilObjTest.php.
References getQuestionType().
{
if ((!$question_type) and ($question_id > 0))
{
$question_type = $this->getQuestionType($question_id);
}
include_once "./Modules/TestQuestionPool/classes/class.".$question_type."GUI.php";
$question_type_gui = $question_type . "GUI";
$question =& new $question_type_gui();
if ($question_id > 0)
{
$question->object->loadFromDb($question_id);
}
return $question;
}
Here is the call graph for this function:| ilObjTest::createReference | ( | ) |
Creates a database reference id for the object.
Creates a database reference id for the object (saves the object to the database and creates a reference id in the database)
public
Reimplemented from ilObject.
Definition at line 530 of file class.ilObjTest.php.
References saveToDb().
{
$result = parent::createReference();
$this->saveToDb();
return $result;
}
Here is the call graph for this function:| & ilObjTest::createTestSequence | ( | $ | active_id, | |
| $ | pass, | |||
| $ | shuffle | |||
| ) |
Definition at line 9363 of file class.ilObjTest.php.
References getQuestionCount(), and isRandomTest().
{
include_once "./Modules/Test/classes/class.ilTestSequence.php";
$this->testSequence = new ilTestSequence($active_id, $pass, $this->isRandomTest());
if (!$this->testSequence->hasSequence())
{
$this->testSequence->createNewSequence($this->getQuestionCount(), $shuffle);
$this->testSequence->saveToDb();
}
}
Here is the call graph for this function:| & ilObjTest::createTestSession | ( | ) |
Creates the test session data for the active user.
Definition at line 9308 of file class.ilObjTest.php.
References $_SESSION, $testSession, and getTestId().
{
global $ilUser;
include_once "./Modules/Test/classes/class.ilTestSession.php";
$testSession = FALSE;
$testSession = new ilTestSession();
$testSession->setTestId($this->getTestId());
$testSession->setUserId($ilUser->getId());
$testSession->setAnonymousId($_SESSION["tst_access_code"][$this->getTestId()]);
$testSession->saveToDb();
$this->testSession =& $testSession;
return $this->testSession;
}
Here is the call graph for this function:| ilObjTest::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 554 of file class.ilObjTest.php.
References ilObject::deleteMetaData(), and deleteTest().
{
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// delet meta data
$this->deleteMetaData();
//put here your module specific stuff
$this->deleteTest();
return true;
}
Here is the call graph for this function:| ilObjTest::deleteDefaults | ( | $ | test_default_id | ) |
Deletes the defaults for a test.
Deletes the defaults for a test
| integer | $test_default_id The database ID of the test defaults public |
Definition at line 9057 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
$ilDB->quote($test_default_id . "")
);
$result = $ilDB->query($query);
}
| ilObjTest::deleteTest | ( | ) |
Deletes the test and all related objects, files and database entries.
Deletes the test and all related objects, files and database entries
public
Definition at line 578 of file class.ilObjTest.php.
References $mobs, ilObjMediaObject::_getMobsOfObject(), ilObjMediaObject::_removeUsage(), ilUtil::delDir(), ilUtil::getDataDir(), ilObject::getId(), removeAllTestEditings(), and removeQuestion().
Referenced by delete().
{
global $ilDB;
$query = sprintf("SELECT active_id FROM tst_active WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$active_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($active_array, $row["active_id"]);
}
$query = sprintf("DELETE FROM tst_active WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
if (count($active_array))
{
foreach ($active_array as $active_id)
{
$query = sprintf("DELETE FROM tst_times WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
$query = sprintf("DELETE FROM tst_sequence WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
}
}
$query = sprintf("DELETE FROM tst_mark WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->removeQuestion($row->question_fi);
}
$query = sprintf("DELETE FROM tst_tests WHERE test_id = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$query = sprintf("DELETE FROM tst_test_random_question USING tst_test_random_question, tst_active WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_test_random_question.active_fi",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
// delete export files
include_once "./Services/Utilities/classes/class.ilUtil.php";
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
$directory = $tst_data_dir."/tst_".$this->getId();
if (is_dir($directory))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->getId());
// remaining usages are not in text anymore -> delete them
// and media objects (note: delete method of ilObjMediaObject
// checks whether object is used in another context; if yes,
// the object is not deleted!)
foreach($mobs as $mob)
{
ilObjMediaObject::_removeUsage($mob, "tst:html", $this->getId());
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->delete();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::deliverPDFfromFO | ( | $ | fo | ) |
Delivers a PDF file from a XSL-FO string.
Delivers a PDF file from a XSL-FO string
| string | $fo The XSL-FO string public |
Definition at line 9203 of file class.ilObjTest.php.
References ilUtil::deliverData(), ilUtil::getASCIIFilename(), ilObject::getTitle(), and ilUtil::ilTempnam().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$fo_file = ilUtil::ilTempnam() . ".fo";
$fp = fopen($fo_file, "w"); fwrite($fp, $fo); fclose($fp);
include_once "./Services/Transformation/classes/class.ilFO2PDF.php";
$fo2pdf = new ilFO2PDF();
$fo2pdf->setFOString($fo);
$result = $fo2pdf->send();
ilUtil::deliverData($result, ilUtil::getASCIIFilename($this->getTitle()) . ".pdf", "application/pdf");
}
Here is the call graph for this function:| ilObjTest::disinviteUser | ( | $ | user_id | ) |
Disinvites a user from a test.
Disinvites a user from a test
| integer | $user_id The database id of the disinvited user public |
Definition at line 7272 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
$ilDB->quote($this->test_id),
$ilDB->quote($user_id)
);
$result = $ilDB->query($query);
}
| ilObjTest::duplicateQuestionForTest | ( | $ | question_id | ) |
Takes a question and creates a copy of the question for use in the test.
Takes a question and creates a copy of the question for use in the test
| integer | $question_id The database id of the question |
Definition at line 3285 of file class.ilObjTest.php.
References _instanciateQuestion().
Referenced by insertQuestion(), and saveRandomQuestion().
{
global $ilUser;
$question =& ilObjTest::_instanciateQuestion($question_id);
$duplicate_id = $question->duplicate(true);
return $duplicate_id;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::endingTimeReached | ( | ) |
Returns true if the ending time of a test is reached.
Returns true if the ending time of a test is reached An ending time is not available for self assessment tests
Definition at line 5426 of file class.ilObjTest.php.
References getEndingTime().
Referenced by canShowTestResults(), and isExecutable().
{
if ($this->getEndingTime())
{
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndingTime(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now > $epoch_time)
{
// ending time reached
return true;
}
}
}
return false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::evalResultsOverview | ( | ) |
Creates an associated array with the results of all participants of a test.
Creates an associated array with the results of all participants of a test
Definition at line 4846 of file class.ilObjTest.php.
References _evalResultsOverview(), and getTestId().
{
return $this->_evalResultsOverview($this->getTestId());
}
Here is the call graph for this function:| & ilObjTest::evalResultsOverviewOfParticipant | ( | $ | active_id | ) |
Creates an associated array with the results for a given participant of a test.
Creates an associated array with the results for a given participant of a test
| integer | $active_id The active id of the participant |
Definition at line 4910 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_test_result.*, qpl_questions.original_id, qpl_questions.title AS questiontitle, " .
"qpl_questions.points AS maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
"ORDER BY active_id, pass, TIMESTAMP",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$overview = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if (!array_key_exists($row["active_fi"], $overview))
{
$overview[$row["active_fi"]] = array();
$overview[$row["active_fi"]]["firstname"] = $row["firstname"];
$overview[$row["active_fi"]]["lastname"] = $row["lastname"];
$overview[$row["active_fi"]]["title"] = $row["title"];
$overview[$row["active_fi"]]["login"] = $row["login"];
$overview[$row["active_fi"]]["usr_id"] = $row["usr_id"];
$overview[$row["active_fi"]]["started"] = $row["started"];
$overview[$row["active_fi"]]["finished"] = $row["finished"];
}
if (!array_key_exists($row["pass"], $overview[$row["active_fi"]]))
{
$overview[$row["active_fi"]][$row["pass"]] = array();
$overview[$row["active_fi"]][$row["pass"]]["reached"] = 0;
$overview[$row["active_fi"]][$row["pass"]]["maxpoints"] = $row["maxpoints"];
}
array_push($overview[$row["active_fi"]][$row["pass"]], $row);
$overview[$row["active_fi"]][$row["pass"]]["reached"] += $row["points"];
}
return $overview;
}
| & ilObjTest::evalStatistical | ( | $ | active_id | ) |
Returns the statistical evaluation of the test for a specified user.
Returns the statistical evaluation of the test for a specified user
Definition at line 4050 of file class.ilObjTest.php.
References _getResultPass(), and getTestResult().
{
global $ilDB;
// global $ilBench;
$pass = ilObjTest::_getResultPass($active_id);
$test_result =& $this->getTestResult($active_id, $pass);
$q = sprintf("SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
$ilDB->quote($active_id)
);
$result = $ilDB->query($q);
$times = array();
$first_visit = 0;
$last_visit = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
if (!$first_visit) {
$first_visit = $epoch_1;
}
if ($epoch_1 < $first_visit) {
$first_visit = $epoch_1;
}
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
if (!$last_visit) {
$last_visit = $epoch_2;
}
if ($epoch_2 > $last_visit) {
$last_visit = $epoch_2;
}
$times[$row->active_fi] += ($epoch_2 - $epoch_1);
}
$max_time = 0;
foreach ($times as $key => $value) {
$max_time += $value;
}
if ((!$test_result["test"]["total_reached_points"]) or (!$test_result["test"]["total_max_points"]))
{
$percentage = 0.0;
}
else
{
$percentage = ($test_result["test"]["total_reached_points"] / $test_result["test"]["total_max_points"]) * 100.0;
if ($percentage < 0) $percentage = 0.0;
}
$mark_obj = $this->mark_schema->getMatchingMark($percentage);
$first_date = getdate($first_visit);
$last_date = getdate($last_visit);
$qworkedthrough = 0;
foreach ($test_result as $key => $value)
{
if (preg_match("/\d+/", $key))
{
$qworkedthrough += $value["workedthrough"];
}
}
if (!$qworkedthrough)
{
$atimeofwork = 0;
}
else
{
$atimeofwork = $max_time / $qworkedthrough;
}
$result_mark = "";
$passed = "";
if ($mark_obj)
{
$result_mark = $mark_obj->getShortName();
if ($mark_obj->getPassed())
{
$passed = 1;
}
else
{
$passed = 0;
}
}
$percent_worked_through = 0;
if (count($this->questions))
{
$percent_worked_through = $qworkedthrough / count($this->questions);
}
$result_array = array(
"qworkedthrough" => $qworkedthrough,
"qmax" => count($this->questions),
"pworkedthrough" => $percent_worked_through,
"timeofwork" => $max_time,
"atimeofwork" => $atimeofwork,
"firstvisit" => $first_date,
"lastvisit" => $last_date,
"resultspoints" => $test_result["test"]["total_reached_points"],
"maxpoints" => $test_result["test"]["total_max_points"],
"resultsmarks" => $result_mark,
"passed" => $passed,
"distancemedian" => "0"
);
foreach ($test_result as $key => $value)
{
if (preg_match("/\d+/", $key))
{
$result_array[$key] = $value;
}
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::evalTotalFinished | ( | ) |
Returns the number of total finished tests.
Returns the number of total finished tests
Definition at line 4337 of file class.ilObjTest.php.
{
global $ilDB;
$q = sprintf("SELECT COUNT(*) as total FROM tst_active WHERE test_fi = %s AND tries > 0",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$row = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $row->total;
}
| & ilObjTest::evalTotalParticipantsArray | ( | $ | name_sort_order = "asc" |
) |
Returns all participants who started the test.
Returns all participants who started the test
Definition at line 4293 of file class.ilObjTest.php.
References getAnonymity().
Referenced by getTotalPointsPassedArray().
{
global $ilDB;
$q = sprintf("SELECT tst_active.active_id, usr_data.login, 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),
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$persons_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($this->getAnonymity())
{
$persons_array[$row["active_id"]] = array("name" => $this->lng->txt("unknown"));
}
else
{
if (strlen($row["firstname"].$row["lastname"].$row["title"]) == 0)
{
$persons_array[$row["active_id"]] = array("name" => $this->lng->txt("deleted_user"));
}
else
{
if ($row["user_fi"] == ANONYMOUS_USER_ID)
{
$persons_array[$row["active_id"]] = array("name" => $row["lastname"]);
}
else
{
$persons_array[$row["active_id"]] = array("name" => trim($row["lastname"] . ", " . $row["firstname"] . " " . $row["title"]), "login" => $row["login"]);
}
}
}
}
return $persons_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::evalTotalPersons | ( | ) |
Returns the number of persons who started the test.
Returns the number of persons who started the test
Definition at line 3878 of file class.ilObjTest.php.
Referenced by applyDefaults(), canEditMarks(), and saveToDb().
{
global $ilDB;
$q = sprintf("SELECT COUNT(*) as total FROM tst_active WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$row = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $row->total;
}
Here is the caller graph for this function:| & ilObjTest::evalTotalPersonsArray | ( | $ | name_sort_order = "asc" |
) |
Returns all persons who started the test.
Returns all persons who started the test
Definition at line 4249 of file class.ilObjTest.php.
References getAnonymity().
{
global $ilDB;
$q = sprintf("SELECT 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),
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$persons_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($this->getAnonymity())
{
$persons_array[$row["active_id"]] = $this->lng->txt("unknown");
}
else
{
if (strlen($row["firstname"].$row["lastname"].$row["title"]) == 0)
{
$persons_array[$row["active_id"]] = $this->lng->txt("deleted_user");
}
else
{
if ($row["user_fi"] == ANONYMOUS_USER_ID)
{
$persons_array[$row["active_id"]] = $row["lastname"];
}
else
{
$persons_array[$row["active_id"]] = trim($row["lastname"] . ", " . $row["firstname"] . " " . $row["title"]);
}
}
}
}
return $persons_array;
}
Here is the call graph for this function:| ilObjTest::evalTotalStartedAverageTime | ( | ) |
Returns the average processing time for all started tests.
Returns the average processing time for all started tests
Definition at line 5039 of file class.ilObjTest.php.
{
global $ilDB;
$q = sprintf("SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$times = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$times[$row->active_fi] += ($epoch_2 - $epoch_1);
}
$max_time = 0;
$counter = 0;
foreach ($times as $key => $value)
{
$max_time += $value;
$counter++;
}
if ($counter)
{
$average_time = round($max_time / $counter);
}
else
{
$average_time = 0;
}
return $average_time;
}
| ilObjTest::exportFileItems | ( | $ | a_target_dir, | |
| &$ | expLog | |||
| ) |
export files of file itmes
Definition at line 6272 of file class.ilObjTest.php.
Referenced by exportPagesXML().
{
include_once "./Modules/File/classes/class.ilObjFile.php";
foreach ($this->file_ids as $file_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
$file_obj = new ilObjFile($file_id, false);
$file_obj->export($a_target_dir);
unset($file_obj);
}
}
Here is the caller graph for this function:| ilObjTest::exportPagesXML | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| $ | a_target_dir, | |||
| &$ | expLog | |||
| ) |
export pages of test to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 6113 of file class.ilObjTest.php.
References $ilBench, exportFileItems(), exportXMLMediaObjects(), exportXMLMetaData(), and exportXMLPageObjects().
{
global $ilBench;
$this->mob_ids = array();
$this->file_ids = array();
$attrs = array();
$attrs["Type"] = "Test";
$a_xml_writer->xmlStartTag("ContentObject", $attrs);
// MetaData
$this->exportXMLMetaData($a_xml_writer);
// PageObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
$ilBench->start("ContentObjectExport", "exportPageObjects");
$this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog);
$ilBench->stop("ContentObjectExport", "exportPageObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
// MediaObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
$ilBench->start("ContentObjectExport", "exportMediaObjects");
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportMediaObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
// FileItems
$expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
$ilBench->start("ContentObjectExport", "exportFileItems");
$this->exportFileItems($a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportFileItems");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
$a_xml_writer->xmlEndTag("ContentObject");
}
Here is the call graph for this function:| ilObjTest::exportXMLMediaObjects | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| $ | a_target_dir, | |||
| &$ | expLog | |||
| ) |
export media objects to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 6254 of file class.ilObjTest.php.
Referenced by exportPagesXML().
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
foreach ($this->mob_ids as $mob_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportXML($a_xml_writer, $a_inst);
$media_obj->exportFiles($a_target_dir);
unset($media_obj);
}
}
Here is the caller graph for this function:| ilObjTest::exportXMLMetaData | ( | &$ | a_xml_writer | ) |
export content objects meta data to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 6157 of file class.ilObjTest.php.
References ilObject::getId(), and ilObject::getType().
Referenced by exportPagesXML().
{
include_once "./Services/MetaData/classes/class.ilMD2XML.php";
$md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::exportXMLPageObjects | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| &$ | expLog | |||
| ) |
export page objects to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 6191 of file class.ilObjTest.php.
References $ilBench.
Referenced by exportPagesXML().
{
global $ilBench;
include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
foreach ($this->questions as $question_id)
{
$ilBench->start("ContentObjectExport", "exportPageObject");
$expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
$attrs = array();
$a_xml_writer->xmlStartTag("PageObject", $attrs);
// export xml to writer object
$ilBench->start("ContentObjectExport", "exportPageObject_XML");
$page_object = new ilPageObject("qpl", $question_id);
$page_object->buildDom();
$page_object->insertInstIntoIDs($a_inst);
$mob_ids = $page_object->collectMediaObjects(false);
$file_ids = $page_object->collectFileItems();
$xml = $page_object->getXMLFromDom(false, false, false, "", true);
$xml = str_replace("&","&", $xml);
$a_xml_writer->appendXML($xml);
$page_object->freeDom();
unset ($page_object);
$ilBench->stop("ContentObjectExport", "exportPageObject_XML");
// collect media objects
$ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
//$mob_ids = $page_obj->getMediaObjectIDs();
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
// collect all file items
$ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
//$file_ids = $page_obj->getFileItemIds();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
$a_xml_writer->xmlEndTag("PageObject");
//unset($page_obj);
$ilBench->stop("ContentObjectExport", "exportPageObject");
}
}
Here is the caller graph for this function:| ilObjTest::fromXML | ( | &$ | assessment | ) |
Creates a test from a QTI file.
Receives parameters from a QTI parser and creates a valid ILIAS test object
| object | $assessment The QTI assessment object public |
Definition at line 5615 of file class.ilObjTest.php.
References $_SESSION, $ilLog, $metadata, ilObject::$type, ilRTE::_replaceMediaObjectImageSrc(), ilObjMediaObject::_saveTempFileAsMediaObject(), ilObjMediaObject::_saveUsage(), ilObject::getId(), getImportDirectory(), getIntroduction(), QTIMaterialToString(), saveToDb(), setAllowedUsers(), setAllowedUsersTimeGap(), setAnonymity(), setAnswerFeedback(), setAnswerFeedbackPoints(), setAuthor(), setCountSystem(), ilObject::setDescription(), setEndingTime(), setFixedParticipants(), setInstantFeedbackSolution(), setIntroduction(), setListOfQuestionsSettings(), setMCScoring(), setNrOfTries(), setPassScoring(), setPassword(), setRandomQuestionCount(), setRandomTest(), setReportingDate(), setResetProcessingTime(), setResultsPresentation(), setScoreCutting(), setScoreReporting(), setSequenceSettings(), setShowCancel(), setShowMarker(), setShowSolutionDetails(), setShowSolutionFeedback(), setShowSolutionPrintview(), setShuffleQuestions(), setStartingTime(), ilObject::setTitle(), setTitleOutput(), and setUsePreviousAnswers().
{
unset($_SESSION["import_mob_xhtml"]);
$this->setDescription($assessment->getComment());
$this->setTitle($assessment->getTitle());
foreach ($assessment->objectives as $objectives)
{
foreach ($objectives->materials as $material)
{
$this->setIntroduction($this->QTIMaterialToString($material));
}
}
foreach ($assessment->assessmentcontrol as $assessmentcontrol)
{
switch ($assessmentcontrol->getSolutionswitch())
{
case "Yes":
$this->setInstantFeedbackSolution(1);
break;
default:
$this->setInstantFeedbackSolution(0);
break;
}
}
foreach ($assessment->qtimetadata as $metadata)
{
switch ($metadata["label"])
{
case "test_type":
// for old tests with a test type
$type = $metadata["entry"];
switch ($type)
{
case 1:
// assessment
$this->setAnonymity(1);
break;
case 2:
// self assessment
break;
case 4:
// online exam
$this->setFixedParticipants(1);
$this->setListOfQuestionsSettings(7);
$this->setShowSolutionPrintview(1);
break;
case 5:
// varying random test
break;
}
break;
case "sequence_settings":
$this->setSequenceSettings($metadata["entry"]);
break;
case "author":
$this->setAuthor($metadata["entry"]);
break;
case "nr_of_tries":
$this->setNrOfTries($metadata["entry"]);
break;
case "hide_previous_results":
if ($metadata["entry"] == 0)
{
$this->setUsePreviousAnswers(1);
}
else
{
$this->setUsePreviousAnswers(0);
}
break;
case "use_previous_answers":
$this->setUsePreviousAnswers($metadata["entry"]);
break;
case "answer_feedback":
$this->setAnswerFeedback($metadata["entry"]);
break;
case "hide_title_points":
$this->setTitleOutput($metadata["entry"]);
break;
case "title_output":
$this->setTitleOutput($metadata["entry"]);
break;
case "random_test":
$this->setRandomTest($metadata["entry"]);
break;
case "random_question_count":
$this->setRandomQuestionCount($metadata["entry"]);
break;
case "results_presentation":
$this->setResultsPresentation($metadata["entry"]);
break;
case "reset_processing_time":
$this->setResetProcessingTime($metadata["entry"]);
break;
case "show_solution_details":
$this->setShowSolutionDetails($metadata["entry"]);
break;
case "show_solution_printview":
$this->setShowSolutionPrintview($metadata["entry"]);
break;
case "show_solution_feedback":
$this->setShowSolutionFeedback($metadata["entry"]);
break;
case "instant_verification":
$this->setInstantFeedbackSolution($metadata["entry"]);
break;
case "answer_feedback_points":
$this->setAnswerFeedbackPoints($metadata["entry"]);
break;
case "anonymity":
$this->setAnonymity($metadata["entry"]);
break;
case "show_cancel":
$this->setShowCancel($metadata["entry"]);
break;
case "show_marker":
$this->setShowMarker($metadata["entry"]);
break;
case "fixed_participants":
$this->setFixedParticipants($metadata["entry"]);
break;
case "score_reporting":
$this->setScoreReporting($metadata["entry"]);
break;
case "shuffle_questions":
$this->setShuffleQuestions($metadata["entry"]);
break;
case "count_system":
$this->setCountSystem($metadata["entry"]);
break;
case "mc_scoring":
$this->setMCScoring($metadata["entry"]);
break;
case "score_cutting":
$this->setScoreCutting($metadata["entry"]);
break;
case "password":
$this->setPassword($metadata["entry"]);
break;
case "allowedUsers":
$this->setAllowedUsers($metadata["entry"]);
break;
case "allowedUsersTimeGap":
$this->setAllowedUsersTimeGap($metadata["entry"]);
break;
case "pass_scoring":
$this->setPassScoring($metadata["entry"]);
break;
case "show_summary":
$this->setListOfQuestionsSettings($metadata["entry"]);
break;
case "reporting_date":
$iso8601period = $metadata["entry"];
if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
{
$this->setReportingDate(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
}
break;
case "starting_time":
$iso8601period = $metadata["entry"];
if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
{
$this->setStartingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
}
break;
case "ending_time":
$iso8601period = $metadata["entry"];
if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
{
$this->setEndingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
}
break;
}
if (preg_match("/mark_step_\d+/", $metadata["label"]))
{
$xmlmark = $metadata["entry"];
preg_match("/<short>(.*?)<\/short>/", $xmlmark, $matches);
$mark_short = $matches[1];
preg_match("/<official>(.*?)<\/official>/", $xmlmark, $matches);
$mark_official = $matches[1];
preg_match("/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
$mark_percentage = $matches[1];
preg_match("/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
$mark_passed = $matches[1];
$this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
}
}
// handle the import of media objects in XHTML code
if (is_array($_SESSION["import_mob_xhtml"]))
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
foreach ($_SESSION["import_mob_xhtml"] as $mob)
{
$importfile = $this->getImportDirectory() . "/" . $_SESSION["tst_import_subdir"] . "/" . $mob["uri"];
if (file_exists($importfile))
{
$media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
ilObjMediaObject::_saveUsage($media_object->getId(), "tst:html", $this->getId());
$this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()), 1));
}
else
{
global $ilLog;
$ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
}
}
$this->saveToDb();
}
}
Here is the call graph for this function:| ilObjTest::generateRandomQuestions | ( | $ | active_id, | |
| $ | pass = NULL | |||
| ) |
Generates new random questions for the active user.
Generates new random questions for the active user
private
Definition at line 1605 of file class.ilObjTest.php.
References $data, $ilErr, ilObject::$ilias, getNrOfResultsForPass(), getRandomQuestionCount(), getRandomQuestionpools(), getShuffleQuestions(), getTestId(), hasRandomQuestionsForPass(), randomSelectQuestions(), and saveRandomQuestion().
{
global $ilUser;
global $ilDB;
if ($active_id > 0)
{
if ($this->hasRandomQuestionsForPass($active_id, $pass) > 0)
{
// Something went wrong. Maybe the user pressed the start button twice
// Questions already exist so there is no need to create new questions
return;
}
if ($pass > 0)
{
if ($this->getNrOfResultsForPass($active_id, $pass - 1) == 0)
{
// This means that someone maybe reloaded the test submission page
// If there are no existing results for the previous test, it makes
// no sense to create a new set of random questions
return;
}
}
}
else
{
// This may not happen! If it happens, raise a fatal error...
global $ilias, $ilErr;
$ilias->raiseError(sprintf($this->lng->txt("error_random_question_generation"), $ilUser->getId(), $this->getTestId()), $ilErr->FATAL);
}
$num = $this->getRandomQuestionCount();
if ($num > 0)
{
$qpls =& $this->getRandomQuestionpools();
$rndquestions = $this->randomSelectQuestions($num, 0, 1, $qpls, $pass);
$allquestions = array();
foreach ($rndquestions as $question_id)
{
array_push($allquestions, $question_id);
}
if ($this->getShuffleQuestions())
{
srand ((float)microtime()*1000000);
shuffle($allquestions);
}
$maxcount = 0;
foreach ($qpls as $data)
{
$maxcount += $data["contains"];
}
if ($num > $maxcount) $num = $maxcount;
foreach ($allquestions as $question_id)
{
$this->saveRandomQuestion($active_id, $question_id, $pass, $num);
}
}
else
{
$qpls =& $this->getRandomQuestionpools();
$allquestions = array();
$maxcount = 0;
foreach ($qpls as $key => $value)
{
if ($value["count"] > 0)
{
$rndquestions = $this->randomSelectQuestions($value["count"], $value["qpl"], 1, $pass);
foreach ($rndquestions as $question_id)
{
array_push($allquestions, $question_id);
}
}
$add = ($value["count"] <= $value["contains"]) ? $value["count"] : $value["contains"];
$maxcount += $add;
}
if ($this->getShuffleQuestions())
{
srand ((float)microtime()*1000000);
shuffle($allquestions);
}
foreach ($allquestions as $question_id)
{
$this->saveRandomQuestion($active_id, $question_id, $pass, $maxcount);
}
}
}
Here is the call graph for this function:| ilObjTest::getAccessCodeSession | ( | ) |
Definition at line 8502 of file class.ilObjTest.php.
References $_SESSION, ilObject::$id, and getTestId().
{
$id = $this->getTestId();
if (!is_array($_SESSION["tst_access_code"]))
{
return "";
}
else
{
return $_SESSION["tst_access_code"]["$id"];
}
}
Here is the call graph for this function:| ilObjTest::getActiveIdOfUser | ( | $ | user_id = "", |
|
| $ | anonymous_id = "" | |||
| ) |
Gets the active id of a given user.
Gets the active id of a given user
| integer | $user_id The database id of the user | |
| string | $anonymous_id The anonymous id if the test is an anonymized test |
Definition at line 3632 of file class.ilObjTest.php.
References $_SESSION, and getTestId().
Referenced by canShowTestResults(), getAllQuestions(), getExistingQuestions(), isExecutable(), loadQuestions(), removeTestResultsForUser(), and setQuestionSetSolved().
{
global $ilDB;
global $ilUser;
if (!$user_id) $user_id = $ilUser->getId();
if (($_SESSION["AccountId"] == ANONYMOUS_USER_ID) && (strlen($_SESSION["tst_access_code"][$this->getTestId()])))
{
$query = sprintf("SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
$ilDB->quote($user_id),
$ilDB->quote($this->test_id),
$ilDB->quote($_SESSION["tst_access_code"][$this->getTestId()])
);
}
else if (strlen($anonymous_id))
{
$query = sprintf("SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
$ilDB->quote($user_id),
$ilDB->quote($this->test_id),
$ilDB->quote($anonymous_id)
);
}
else
{
if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
{
return NULL;
}
$query = sprintf("SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
$ilDB->quote($user_id),
$ilDB->quote($this->test_id)
);
}
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["active_id"];
}
else
{
return 0;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getAllowedUsers | ( | ) |
Definition at line 8531 of file class.ilObjTest.php.
Referenced by checkMaximumAllowedUsers(), saveToDb(), and toXML().
{
return $this->allowedUsers;
}
Here is the caller graph for this function:| ilObjTest::getAllowedUsersTimeGap | ( | ) |
Definition at line 8541 of file class.ilObjTest.php.
Referenced by checkMaximumAllowedUsers(), saveToDb(), and toXML().
{
return $this->allowedUsersTimeGap;
}
Here is the caller graph for this function:| & ilObjTest::getAllQuestions | ( | $ | pass = NULL |
) |
Returns all questions of a test in test order.
Returns all questions of a test in test order
Definition at line 3589 of file class.ilObjTest.php.
References _getPass(), getActiveIdOfUser(), isRandomTest(), and loadQuestions().
{
global $ilUser;
global $ilDB;
$result_array = array();
if ($this->isRandomTest())
{
$active_id = $this->getActiveIdOfUser($ilUser->getId());
$this->loadQuestions($active_id, $pass);
if (count($this->questions) == 0) return $result_array;
if (is_null($pass))
{
$pass = $this->_getPass($active_id);
}
$query = sprintf("SELECT qpl_questions.* FROM qpl_questions, tst_test_random_question WHERE tst_test_random_question.question_fi = qpl_questions.question_id AND tst_test_random_question.active_fi = %s AND tst_test_random_question.pass = %s AND qpl_questions.question_id IN ('" . join($this->questions, "','") . "')",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
}
else
{
if (count($this->questions) == 0) return $result_array;
$query = "SELECT qpl_questions.* FROM qpl_questions, tst_test_question WHERE tst_test_question.question_fi = qpl_questions.question_id AND qpl_questions.question_id IN ('" . join($this->questions, "','") . "')";
}
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$result_array[$row["question_id"]] = $row;
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::getAllRTEContent | ( | ) |
Returns the content of all RTE enabled text areas in the test.
Returns the content of all RTE enabled text areas in the test
private
Definition at line 1102 of file class.ilObjTest.php.
References getIntroduction().
Referenced by cleanupMediaobjectUsage().
{
$result = array();
array_push($result, $this->getIntroduction());
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getAnonymity | ( | ) |
Returns the anonymity status of the test.
Returns the anonymity status of the test
Definition at line 8753 of file class.ilObjTest.php.
Referenced by addDefaults(), buildName(), cloneObject(), evalTotalParticipantsArray(), evalTotalPersonsArray(), getInvitedUsers(), getParticipants(), getTestParticipants(), getUserData(), saveToDb(), toXML(), and userLookupFullName().
{
return $this->anonymity;
}
Here is the caller graph for this function:| ilObjTest::getAnsweredQuestionCount | ( | $ | active_id, | |
| $ | pass = NULL | |||
| ) |
Retrieves the number of answered questions for a given user in a given test.
Retrieves the number of answered questions for a given user in a given test
| integer | $user_id The user id | |
| integer | $test_id The test id | |
| integer | $pass The pass of the test (optional) |
Definition at line 7585 of file class.ilObjTest.php.
References assQuestion::_isWorkedThrough(), isRandomTest(), and loadQuestions().
{
if ($this->isRandomTest())
{
$this->loadQuestions($active_id, $pass);
}
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$workedthrough = 0;
foreach ($this->questions as $value)
{
if (assQuestion::_isWorkedThrough($active_id, $value, $pass))
{
$workedthrough += 1;
}
}
return $workedthrough;
}
Here is the call graph for this function:| ilObjTest::getAnswerFeedback | ( | ) |
Returns 1 if answer specific feedback is activated.
Returns 1 if answer specific feedback is activated
Definition at line 2303 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->answer_feedback;
}
Here is the caller graph for this function:| ilObjTest::getAnswerFeedbackPoints | ( | ) |
Returns 1 if answer specific feedback as reached points is activated.
Returns 1 if answer specific feedback as reached points is activated
Definition at line 2317 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->answer_feedback_points;
}
Here is the caller graph for this function:| & ilObjTest::getArrayData | ( | $ | query, | |
| $ | id_field | |||
| ) |
Returns a data as id key list.
Returns a data as id key list
| $query | ||
| $id_field | index for array |
Definition at line 7178 of file class.ilObjTest.php.
References _getArrayData().
Referenced by getGroupData(), getInvitedUsers(), getRoleData(), getTestParticipants(), and getUserData().
{
return ilObjTest::_getArrayData ($query, $id_field);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getAuthor | ( | ) |
Gets the authors name.
Gets the authors name of the ilObjTest object
Definition at line 6462 of file class.ilObjTest.php.
References $author, ilObject::$id, ilObject::getId(), and ilObject::getType().
Referenced by cloneObject(), loadFromDb(), and toXML().
{
$author = array();
include_once "./Services/MetaData/classes/class.ilMD.php";
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_life =& $md->getLifecycle();
if ($md_life)
{
$ids =& $md_life->getContributeIds();
foreach ($ids as $id)
{
$md_cont =& $md_life->getContribute($id);
if (strcmp($md_cont->getRole(), "Author") == 0)
{
$entids =& $md_cont->getEntityIds();
foreach ($entids as $entid)
{
$md_ent =& $md_cont->getEntity($entid);
array_push($author, $md_ent->getEntity());
}
}
}
}
return join($author, ",");
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getAvailableDefaults | ( | $ | sortby = "name", |
|
| $ | sortorder = "asc" | |||
| ) |
Returns the available test defaults for the active user.
Returns the available test defaults for the active user
| string | $sortby Sort field for the database query | |
| string | $sortorder Sort order for the database query |
Definition at line 9004 of file class.ilObjTest.php.
{
global $ilDB;
global $ilUser;
$query = sprintf("SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY $sortby $sortorder",
$ilDB->quote($ilUser->getId() . "")
);
$result = $ilDB->query($query);
$defaults = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$defaults[$row["test_defaults_id"]] = $row;
}
return $defaults;
}
| & ilObjTest::getAvailableQuestionpools | ( | $ | use_object_id = false, |
|
| $ | equal_points = false, |
|||
| $ | could_be_offline = false, |
|||
| $ | show_path = FALSE, |
|||
| $ | with_questioncount = FALSE, |
|||
| $ | permission = "read" | |||
| ) |
Returns the available question pools for the active user.
Returns the available question pools for the active user
Definition at line 5082 of file class.ilObjTest.php.
References ilObjQuestionPool::_getAvailableQuestionpools().
{
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
return ilObjQuestionPool::_getAvailableQuestionpools($use_object_id, $equal_points, $could_be_offline, $show_path, $with_questioncount, $permission);
}
Here is the call graph for this function:| ilObjTest::getCertificateVisibility | ( | ) |
Returns the visibility settings of the certificate.
Returns the visibility settings of the certificate
Definition at line 8727 of file class.ilObjTest.php.
Referenced by canShowCertificate().
{
return $this->certificate_visibility;
}
Here is the caller graph for this function:| & ilObjTest::getCompleteEvaluationData | ( | $ | withStatistics = TRUE, |
|
| $ | filterby = "", |
|||
| $ | filtertext = "" | |||
| ) |
Definition at line 4617 of file class.ilObjTest.php.
References $data, and getUnfilteredEvaluationData().
{
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
$data = $this->getUnfilteredEvaluationData();
if ($withStatistics)
{
$data->calculateStatistics();
}
$data->setFilter($filterby, $filtertext);
return $data;
}
Here is the call graph for this function:| ilObjTest::getCompleteWorkingTime | ( | $ | user_id | ) |
Returns the complete working time in seconds a user worked on the test.
Returns the complete working time in seconds a user worked on the test
Definition at line 3898 of file class.ilObjTest.php.
{
global $ilDB;
$q = sprintf("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",
$ilDB->quote($this->getTestId()),
$ilDB->quote($user_id)
);
$result = $ilDB->query($q);
$time = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$time += ($epoch_2 - $epoch_1);
}
return $time;
}
| ilObjTest::getCompleteWorkingTimeOfParticipant | ( | $ | active_id | ) |
Returns the complete working time in seconds for a test participant.
Returns the complete working time in seconds for a test participant
Definition at line 3974 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("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",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$time = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$time += ($epoch_2 - $epoch_1);
}
return $time;
}
| & ilObjTest::getCompleteWorkingTimeOfParticipants | ( | ) |
Returns the complete working time in seconds for all test participants.
Returns the complete working time in seconds for all test participants
Definition at line 3927 of file class.ilObjTest.php.
References _getCompleteWorkingTimeOfParticipants(), and getTestId().
Referenced by getUnfilteredEvaluationData().
{
return $this->_getCompleteWorkingTimeOfParticipants($this->getTestId());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getCountSystem | ( | ) |
Gets the count system for the calculation of points.
Gets the count system for the calculation of points
Definition at line 2331 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), and toXML().
{
return $this->count_system;
}
Here is the caller graph for this function:| ilObjTest::getECTSFX | ( | ) |
Returns the ECTS FX grade.
Returns the ECTS FX grade
Definition at line 2058 of file class.ilObjTest.php.
Referenced by addDefaults(), and cloneObject().
{
return $this->ects_fx;
}
Here is the caller graph for this function:| ilObjTest::getECTSGrade | ( | $ | reached_points, | |
| $ | max_points | |||
| ) |
Returns the ECTS grade for a number of reached points.
Returns the ECTS grade for a number of reached points
| double | $reached_points The points reached in the test | |
| double | $max_points The maximum number of points for the test |
Definition at line 6311 of file class.ilObjTest.php.
References _getECTSGrade(), and getTotalPointsPassedArray().
Referenced by getUnfilteredEvaluationData().
{
$passed_array =& $this->getTotalPointsPassedArray();
return ilObjTest::_getECTSGrade($passed_array, $reached_points, $max_points, $this->ects_grades["A"], $this->ects_grades["B"], $this->ects_grades["C"], $this->ects_grades["D"], $this->ects_grades["E"], $this->ects_fx);
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getECTSGrades | ( | ) |
Returns the ECTS grades.
Returns the ECTS grades
Definition at line 2086 of file class.ilObjTest.php.
Referenced by addDefaults(), and cloneObject().
{
return $this->ects_grades;
}
Here is the caller graph for this function:| ilObjTest::getECTSOutput | ( | ) |
Indicates if ECTS grades output is presented in this test.
Indicates if ECTS grades output is presented in this test
Definition at line 2030 of file class.ilObjTest.php.
Referenced by addDefaults(), and cloneObject().
{
return $this->ects_output;
}
Here is the caller graph for this function:| ilObjTest::getEnableProcessingTime | ( | ) |
Returns the state of the processing time (enabled/disabled).
Returns the state of the processing time (enabled/disabled)
Definition at line 2679 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), isExecutable(), and isMaxProcessingTimeReached().
{
return $this->enable_processing_time;
}
Here is the caller graph for this function:| ilObjTest::getEndingTime | ( | ) |
Returns the ending time of the test.
Returns the ending time of the test
Definition at line 2721 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), endingTimeReached(), getSecondsUntilEndingTime(), isExecutable(), and toXML().
{
return $this->ending_time;
}
Here is the caller graph for this function:| ilObjTest::getEstimatedWorkingTime | ( | ) |
Returns the estimated working time for the test calculated from the working time of the contained questions.
Returns the estimated working time for the test calculated from the working time of the contained questions
Definition at line 5096 of file class.ilObjTest.php.
References _instanciateQuestion().
{
$time_in_seconds = 0;
foreach ($this->questions as $question_id)
{
$question =& ilObjTest::_instanciateQuestion($question_id);
$est_time = $question->getEstimatedWorkingTime();
$time_in_seconds += $est_time["h"] * 3600 + $est_time["m"] * 60 + $est_time["s"];
}
$hours = (int)($time_in_seconds / 3600) ;
$time_in_seconds = $time_in_seconds - ($hours * 3600);
$minutes = (int)($time_in_seconds / 60);
$time_in_seconds = $time_in_seconds - ($minutes * 60);
$result = array("h" => $hours, "m" => $minutes, "s" => $time_in_seconds);
return $result;
}
Here is the call graph for this function:| & ilObjTest::getExistingQuestions | ( | $ | pass = NULL |
) |
Get the id's of the questions which are already part of the test.
Get the id's of the questions which are already part of the test
Definition at line 3427 of file class.ilObjTest.php.
References $data, getActiveIdOfUser(), and isRandomTest().
{
global $ilUser;
global $ilDB;
$existing_questions = array();
$active_id = $this->getActiveIdOfUser($ilUser->getId());
if ($this->isRandomTest())
{
if (is_null($pass)) $pass = 0;
$query = sprintf("SELECT qpl_questions.original_id FROM qpl_questions, tst_test_random_question WHERE tst_test_random_question.active_fi = %s AND tst_test_random_question.question_fi = qpl_questions.question_id AND tst_test_random_question.pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
}
else
{
$query = sprintf("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",
$ilDB->quote($this->getTestId())
);
}
$result = $ilDB->query($query);
while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push($existing_questions, $data->original_id);
}
return $existing_questions;
}
Here is the call graph for this function:| ilObjTest::getExportDirectory | ( | ) |
Get the location of the export directory for the test.
Get the location of the export directory for the test
public
Definition at line 803 of file class.ilObjTest.php.
References ilUtil::getDataDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$export_dir = ilUtil::getDataDir()."/tst_data"."/tst_".$this->getId()."/export";
return $export_dir;
}
Here is the call graph for this function:| ilObjTest::getExportFiles | ( | $ | dir | ) |
Get a list of the already exported files in the export directory.
Get a list of the already exported files in the export directory
Definition at line 818 of file class.ilObjTest.php.
{
// quit if import dir not available
if (!@is_dir($dir) or
!is_writeable($dir))
{
return array();
}
// open directory
$dir = dir($dir);
// initialize array
$file = array();
// get files and save the in the array
while ($entry = $dir->read())
{
if ($entry != "." and
$entry != ".." and
//substr($entry, -4) == ".zip" and
ereg("^[0-9]{10}_{2}[0-9]+_{2}(test(__results)?__)*[0-9]+\.[a-z]{1,3}\$", $entry))
{
$file[] = $entry;
}
}
// close import directory
$dir->close();
// sort files
sort ($file);
reset ($file);
return $file;
}
| ilObjTest::getFixedParticipants | ( | ) |
Returns the fixed participants status.
Returns the fixed participants status
Definition at line 8855 of file class.ilObjTest.php.
Referenced by cloneObject(), saveToDb(), and toXML().
{
return $this->fixed_participants;
}
Here is the caller graph for this function:| & ilObjTest::getGroupData | ( | $ | ids | ) |
Definition at line 7194 of file class.ilObjTest.php.
References getArrayData().
{
if (!is_array($ids) || count($ids) ==0)
return array();
$result_array = array();
$query = sprintf("SELECT ref_id, title, description FROM `grp_data` g, object_data o, object_reference r WHERE o.obj_id=grp_id AND o.obj_id = r.obj_id AND ref_id IN ('%s')",
join ($ids,"','")
);
return $this->getArrayData ($query, "ref_id");
}
Here is the call graph for this function:| ilObjTest::getImagePath | ( | ) |
Returns the image path for web accessable images of a test.
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 5266 of file class.ilObjTest.php.
References ilObject::getId().
Referenced by getQuestionsTable().
{
return CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/images/";
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getImagePathWeb | ( | ) |
Returns the web image path for web accessable images of a test.
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 5279 of file class.ilObjTest.php.
References ilObject::getId(), and ilUtil::removeTrailingPathSeparators().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/" . $this->getId() . "/images/";
return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
}
Here is the call graph for this function:| ilObjTest::getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 940 of file class.ilObjTest.php.
References ilUtil::getDataDir().
Referenced by fromXML().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$import_dir = ilUtil::getDataDir()."/tst_data/tst_import";
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getImportMapping | ( | ) |
get array of (two) new created questions for import id
Definition at line 6289 of file class.ilObjTest.php.
{
if (!is_array($this->import_mapping))
{
return array();
}
else
{
return $this->import_mapping;
}
}
| ilObjTest::getInstantFeedbackSolution | ( | ) |
Returns 1 if the correct solution will be shown after answering a question.
Returns 1 if the correct solution will be shown after answering a question
Definition at line 2289 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->instant_verification;
}
Here is the caller graph for this function:| ilObjTest::getIntroduction | ( | ) |
Gets the introduction.
Gets the introduction text of the ilObjTest object
Definition at line 2002 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), fromXML(), getAllRTEContent(), and toXML().
{
return $this->introduction;
}
Here is the caller graph for this function:| & ilObjTest::getInvitedUsers | ( | $ | user_id = "", |
|
| $ | order = "login, lastname, firstname" | |||
| ) |
Returns a list of all invited users in a test.
Returns a list of all invited users in a test
Definition at line 7030 of file class.ilObjTest.php.
References getAnonymity(), and getArrayData().
{
global $ilDB;
$result_array = array();
if ($this->getAnonymity())
{
if (is_numeric($user_id))
{
$query = sprintf("SELECT tst_active.active_id, tst_active.tries, usr_id, '' AS login, %s AS lastname, '' AS firstname, tst_invited_user.clientip, " .
"tst_active.submitted as test_finished, matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started " .
"FROM usr_data, tst_invited_user " .
"LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
"WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
"ORDER BY %s",
$ilDB->quote($this->lng->txt("unknown")),
$ilDB->quote($this->test_id),
$user_id,
$order
);
}
else
{
$query = sprintf("SELECT tst_active.active_id, usr_id, '' AS login, %s AS lastname, '' AS firstname, tst_invited_user.clientip, " .
"tst_active.submitted as test_finished, matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started " .
"FROM usr_data, tst_invited_user " .
"LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
"WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
"ORDER BY %s",
$ilDB->quote($this->lng->txt("unknown")),
$ilDB->quote($this->test_id),
$order
);
}
}
else
{
if (is_numeric($user_id))
{
$query = sprintf("SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
"tst_active.submitted as test_finished, matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started " .
"FROM usr_data, tst_invited_user " .
"LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
"WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
"ORDER BY %s",
$ilDB->quote($this->test_id),
$user_id,
$order
);
}
else
{
$query = sprintf("SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
"tst_active.submitted as test_finished, matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started " .
"FROM usr_data, tst_invited_user " .
"LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
"WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
"ORDER BY %s",
$ilDB->quote($this->test_id),
$order
);
}
}
return $this->getArrayData($query, "usr_id");
}
Here is the call graph for this function:| ilObjTest::getJavaScriptOutput | ( | ) |
Returns if Javascript should be chosen for drag & drop actions for the active user.
Definition at line 9295 of file class.ilObjTest.php.
{
global $ilUser;
$assessmentSetting = new ilSetting("assessment");
return ($ilUser->getPref("tst_javascript") === FALSE) ? $assessmentSetting->get("use_javascript") : $ilUser->getPref("tst_javascript");
}
| ilObjTest::getListOfQuestions | ( | ) |
Returns if the list of questions should be presented to the user or not.
Returns if the list of questions should be presented to the user or not
Definition at line 7953 of file class.ilObjTest.php.
Referenced by setListOfQuestionsDescription(), setListOfQuestionsEnd(), and setListOfQuestionsStart().
{
if (($this->show_summary & 1) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getListOfQuestionsDescription | ( | ) |
Returns TRUE if the list of questions should be presented with the question descriptions.
Returns TRUE if the list of questions should be presented with the question descriptions
Definition at line 8079 of file class.ilObjTest.php.
Referenced by setListOfQuestionsDescription().
{
if (($this->show_summary & 8) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getListOfQuestionsEnd | ( | ) |
Returns if the list of questions should be presented as the last page of the test.
Returns if the list of questions should be presented as the last page of the test
Definition at line 8036 of file class.ilObjTest.php.
Referenced by setListOfQuestionsEnd().
{
if (($this->show_summary & 4) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getListOfQuestionsSettings | ( | ) |
Returns the settings for the list of questions options in the test properties.
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
Definition at line 7921 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->show_summary;
}
Here is the caller graph for this function:| ilObjTest::getListOfQuestionsStart | ( | ) |
Returns if the list of questions should be presented as the first page of the test.
Returns if the list of questions should be presented as the first page of the test
Definition at line 7993 of file class.ilObjTest.php.
Referenced by setListOfQuestionsStart().
{
if (($this->show_summary & 2) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| static ilObjTest::getManualFeedback | ( | $ | active_id, | |
| $ | question_id, | |||
| $ | pass | |||
| ) | [static] |
Retrieves the manual feedback for a question in a test.
Retrieves the manual feedback for a question in a test
| integer | $active_id Active ID of the user | |
| integer | $question_id Question ID | |
| integer | $pass Pass number |
Definition at line 9226 of file class.ilObjTest.php.
References ilRTE::_replaceMediaObjectImageSrc().
Referenced by assQuestionGUI::getAnswerFeedbackOutput().
{
global $ilDB;
$feedback = "";
$query = sprintf("SELECT feedback FROM tst_manual_feedback WHERE active_fi = %s AND question_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
include_once("./Services/RTE/classes/class.ilRTE.php");
$feedback = ilRTE::_replaceMediaObjectImageSrc($row["feedback"], 1);
}
return $feedback;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getMCScoring | ( | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 2369 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), and toXML().
{
return $this->mc_scoring;
}
Here is the caller graph for this function:| ilObjTest::getMembershipByType | ( | $ | a_usr_id, | |
| $ | a_type | |||
| ) | [private] |
Definition at line 4439 of file class.ilObjTest.php.
References $res.
{
global $ilDB;
$query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua AS ua ".
"JOIN rbac_fa AS fa ON ua.rol_id = fa.rol_id ".
"JOIN tree AS t1 ON t1.child = fa.parent ".
"JOIN object_reference AS obr ON t1.parent = obr.ref_id ".
"JOIN object_data AS obd ON obr.obj_id = obd.obj_id ".
"WHERE obd.type = ".$ilDB->quote($a_type)." ".
"AND fa.assign = 'y' ".
"AND ua.usr_id = ".$ilDB->quote($a_usr_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ref_ids[] = $row->obj_id;
}
return $ref_ids ? $ref_ids : array();
}
| ilObjTest::getNrOfResultsForPass | ( | $ | active_id, | |
| $ | pass | |||
| ) |
Calculates the number of user results for a specific test pass.
Calculates the number of user results for a specific test pass
private
Definition at line 1557 of file class.ilObjTest.php.
Referenced by generateRandomQuestions(), and getStartTestLabel().
{
global $ilDB;
$query = sprintf("SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
return $result->numRows();
}
Here is the caller graph for this function:| ilObjTest::getNrOfTries | ( | ) |
Returns the nr of tries for the test.
Returns the nr of tries for the test
Definition at line 2511 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), getStartTestLabel(), hasNrOfTriesRestriction(), isExecutable(), isNrOfTriesReached(), saveToDb(), and toXML().
{
return $this->nr_of_tries;
}
Here is the caller graph for this function:| & ilObjTest::getParticipants | ( | ) |
Returns all persons who started the test.
Returns all persons who started the test
Definition at line 4196 of file class.ilObjTest.php.
References getAnonymity().
{
global $ilDB;
$q = sprintf("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",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($q);
$persons_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$name = $this->lng->txt("unknown");
$fullname = $this->lng->txt("unknown");
$login = "";
if (!$this->getAnonymity())
{
if (strlen($row["firstname"].$row["lastname"].$row["title"]) == 0)
{
$name = $this->lng->txt("deleted_user");
$fullname = $this->lng->txt("deleted_user");
$login = $this->lng->txt("unknown");
}
else
{
$login = $row["login"];
if ($row["user_fi"] == ANONYMOUS_USER_ID)
{
$name = $this->lng->txt("unknown");
$fullname = $this->lng->txt("unknown");
}
else
{
$name = trim($row["lastname"] . ", " . $row["firstname"] . " " . $row["title"]);
$fullname = trim($row["title"] . " " . $row["firstname"] . " " . $row["lastname"]);
}
}
}
$persons_array[$row["active_id"]] = array(
"name" => $name,
"fullname" => $fullname,
"login" => $login
);
}
return $persons_array;
}
Here is the call graph for this function:| ilObjTest::getPassFinishDate | ( | $ | active_id, | |
| $ | pass | |||
| ) |
Retrieves the number of answered questions for a given user in a given test.
Retrieves the number of answered questions for a given user in a given test
| integer | $user_id The user id | |
| integer | $test_id The test id | |
| integer | $pass The pass of the test |
Definition at line 7614 of file class.ilObjTest.php.
Referenced by isTestFinishedToViewResults().
{
global $ilDB;
if (is_null($pass)) $pass = 0;
$query = sprintf("SELECT tst_test_result.TIMESTAMP + 0 AS TIMESTAMP14 FROM tst_test_result WHERE active_fi = %s AND pass = %s ORDER BY tst_test_result.TIMESTAMP DESC",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["TIMESTAMP14"];
}
else
{
return 0;
}
}
Here is the caller graph for this function:| ilObjTest::getPassScoring | ( | ) |
Gets the pass scoring type.
Gets the pass scoring type
Definition at line 2411 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), getUnfilteredEvaluationData(), saveToDb(), and toXML().
{
return $this->pass_scoring;
}
Here is the caller graph for this function:| ilObjTest::getPassword | ( | ) |
Returns the password for test access.
Returns the password for test access
Definition at line 2397 of file class.ilObjTest.php.
Referenced by cloneObject(), saveToDb(), and toXML().
{
return $this->password;
}
Here is the caller graph for this function:| ilObjTest::getProcessingTime | ( | ) |
Returns the processing time for the test.
Returns the processing time for the test
Definition at line 2621 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), and getProcessingTimeInSeconds().
{
return $this->processing_time;
}
Here is the caller graph for this function:| ilObjTest::getProcessingTimeInSeconds | ( | ) |
Returns the processing time for the test in seconds.
Returns the processing time for the test in seconds
Definition at line 2635 of file class.ilObjTest.php.
References getProcessingTime().
Referenced by isMaxProcessingTimeReached().
{
if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $this->getProcessingTime(), $matches))
{
return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3];
}
else
{
return 0;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getQuestionCount | ( | ) |
Returns the number of questions in the test.
Returns the number of questions in the test
Definition at line 6702 of file class.ilObjTest.php.
References $data, getRandomQuestionCount(), getRandomQuestionpools(), and isRandomTest().
Referenced by applyDefaults(), createTestSequence(), getQuestionsOfPass(), getQuestionsOfTest(), and getUnfilteredEvaluationData().
{
$num = 0;
if ($this->isRandomTest())
{
if ($this->getRandomQuestionCount())
{
$num = $this->getRandomQuestionCount();
$qpls =& $this->getRandomQuestionpools();
$maxcount = 0;
foreach ($qpls as $data)
{
$maxcount += $data["contains"];
}
if ($num > $maxcount) $num = $maxcount;
}
else
{
$qpls =& $this->getRandomQuestionpools();
foreach ($qpls as $data)
{
$add = ($data["count"] <= $data["contains"]) ? $data["count"] : $data["contains"];
$num += $add;
}
}
}
else
{
$num = count($this->questions);
}
return $num;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getQuestionDataset | ( | $ | question_id | ) |
Returns the dataset for a given question id.
Returns the dataset for a given question id
| integer | $question_id The database id of the question |
Definition at line 3407 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
$ilDB->quote("$question_id")
);
$result = $ilDB->query($query);
$row = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $row;
}
| & ilObjTest::getQuestionsOfPass | ( | $ | active_id, | |
| $ | pass | |||
| ) |
Retrieves all the assigned questions for a test participant in a given test pass.
Retrieves all the assigned questions for a test participant in a given test pass
Definition at line 4401 of file class.ilObjTest.php.
References getQuestionCount(), and isRandomTest().
{
global $ilDB;
if ($this->isRandomTest())
{
$query = sprintf("SELECT tst_test_random_question.sequence, tst_test_random_question.question_fi, " .
"qpl_questions.points " .
"FROM tst_test_random_question, qpl_questions " .
"WHERE tst_test_random_question.question_fi = qpl_questions.question_id " .
"AND tst_test_random_question.active_fi = %s AND tst_test_random_question.pass = %s " .
"ORDER BY tst_test_random_question.sequence LIMIT 0, %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . ""),
$this->getQuestionCount()
);
}
else
{
$query = sprintf("SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
"qpl_questions.points " .
"FROM tst_test_question, tst_active, qpl_questions " .
"WHERE tst_test_question.question_fi = qpl_questions.question_id " .
"AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
$ilDB->quote($active_id . "")
);
}
$result = $ilDB->query($query);
$qpass = array();
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($qpass, $row);
}
}
return $qpass;
}
Here is the call graph for this function:| & ilObjTest::getQuestionsOfTest | ( | $ | active_id | ) |
Retrieves all the assigned questions for all test passes of a test participant.
Retrieves all the assigned questions for all test passes of a test participant
Definition at line 4357 of file class.ilObjTest.php.
References getQuestionCount(), and isRandomTest().
{
global $ilDB;
if ($this->isRandomTest())
{
$query = sprintf("SELECT tst_test_random_question.sequence, tst_test_random_question.question_fi, " .
"tst_test_random_question.pass, qpl_questions.points " .
"FROM tst_test_random_question, qpl_questions " .
"WHERE tst_test_random_question.question_fi = qpl_questions.question_id " .
"AND tst_test_random_question.active_fi = %s ORDER BY tst_test_random_question.sequence LIMIT 0, %s",
$ilDB->quote($active_id . ""),
$this->getQuestionCount()
);
}
else
{
$query = sprintf("SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
"qpl_questions.points " .
"FROM tst_test_question, tst_active, qpl_questions " .
"WHERE tst_test_question.question_fi = qpl_questions.question_id " .
"AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
$ilDB->quote($active_id . "")
);
}
$result = $ilDB->query($query);
$qtest = array();
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($qtest, $row);
}
}
return $qtest;
}
Here is the call graph for this function:| ilObjTest::getQuestionsTable | ( | $ | sort, | |
| $ | sortorder, | |||
| $ | textfilter, | |||
| $ | startrow = 0, |
|||
| $ | completeonly = 0, |
|||
| $ | filter_question_type = "", |
|||
| $ | filter_questionpool = "" | |||
| ) |
Calculates the data for the output of the questionpool.
Calculates the data for the output of the questionpool
public
Definition at line 5451 of file class.ilObjTest.php.
References ilObjQuestionPool::_getAvailableQuestionpools(), and getImagePath().
{
global $ilUser;
global $ilDB;
$where = "";
foreach ($textfilter as $sel_filter_type => $filter_text)
{
if (strlen($filter_text) > 0)
{
switch($sel_filter_type)
{
case "title":
$where .= " AND qpl_questions.title LIKE " . $ilDB->quote("%" . $filter_text . "%");
break;
case "comment":
$where .= " AND qpl_questions.comment LIKE " . $ilDB->quote("%" . $filter_text . "%");
break;
case "author":
$where .= " AND qpl_questions.author LIKE " . $ilDB->quote("%" . $filter_text . "%");
break;
case "qpl":
$where .= " AND object_data.title LIKE " . $ilDB->quote("%" . $filter_text . "%");
break;
}
}
}
if ($filter_question_type && (strcmp($filter_question_type, "all") != 0))
{
$where .= " AND qpl_question_type.type_tag = " . $ilDB->quote($filter_question_type);
}
if ($filter_questionpool && (strcmp($filter_questionpool, "all") != 0))
{
$where .= " AND qpl_questions.obj_fi = $filter_questionpool";
}
// build sort order for sql query
$order = "";
$images = array();
include_once "./Services/Utilities/classes/class.ilUtil.php";
switch($sort)
{
case "title":
$order = " ORDER BY qpl_questions.title $sortorder";
$images["title"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "comment":
$order = " ORDER BY comment $sortorder";
$images["comment"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "type":
$order = " ORDER BY question_type_id $sortorder";
$images["type"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "author":
$order = " ORDER BY author $sortorder";
$images["author"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "created":
$order = " ORDER BY created $sortorder";
$images["created"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "updated":
$order = " ORDER BY TIMESTAMP14 $sortorder";
$images["updated"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
case "qpl":
$order = " ORDER BY UPPER(object_data.title) $sortorder";
$images["qpl"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . $this->lng->txt(strtolower($sortorder) . "ending_order")."\" />";
break;
}
$maxentries = $ilUser->prefs["hits_per_page"];
if ($maxentries < 1)
{
$maxentries = 9999;
}
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
$available_pools = array_keys(ilObjQuestionPool::_getAvailableQuestionpools($use_object_id = TRUE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE));
$available = "";
if (count($available_pools))
{
$available = " AND qpl_questions.obj_fi IN ('" . join($available_pools, "','") . "')";
}
else
{
return array();
}
if ($completeonly)
{
$available .= " AND qpl_questions.complete = " . $ilDB->quote("1");
}
// get all questions in the test
$query = sprintf("SELECT qpl_questions.original_id, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14 FROM qpl_questions, tst_test_question, object_data WHERE qpl_questions.question_id = tst_test_question.question_fi AND object_data.obj_id = qpl_questions.obj_fi AND tst_test_question.test_fi = %s",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
$original_ids = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if (strcmp($row[0], "") != 0)
{
array_push($original_ids, $row[0]);
}
}
$original_clause = " ISNULL(qpl_questions.original_id)";
if (count($original_ids))
{
$original_clause = " ISNULL(qpl_questions.original_id) AND qpl_questions.question_id NOT IN ('" . join($original_ids, "','") . "')";
}
$query = "SELECT qpl_questions.question_id, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14 FROM qpl_questions, qpl_question_type, object_data WHERE $original_clause$available AND object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.question_type_fi = qpl_question_type.question_type_id $where$order$limit";
$query_result = $ilDB->query($query);
$max = $query_result->numRows();
if ($startrow > $max -1)
{
$startrow = $max - ($max % $maxentries);
}
else if ($startrow < 0)
{
$startrow = 0;
}
$limit = " LIMIT $startrow, $maxentries";
$query = "SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type, object_data WHERE $original_clause $available AND object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.question_type_fi = qpl_question_type.question_type_id $where$order$limit";
$query_result = $ilDB->query($query);
$rows = array();
if ($query_result->numRows())
{
while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($rows, $row);
}
}
$nextrow = $startrow + $maxentries;
if ($nextrow > $max - 1)
{
$nextrow = $startrow;
}
$prevrow = $startrow - $maxentries;
if ($prevrow < 0)
{
$prevrow = 0;
}
return array(
"rows" => $rows,
"images" => $images,
"startrow" => $startrow,
"nextrow" => $nextrow,
"prevrow" => $prevrow,
"step" => $maxentries,
"rowcount" => $max
);
}
Here is the call graph for this function:| ilObjTest::getQuestiontext | ( | $ | question_id | ) |
Returns the question text for a given question.
Returns the question text for a given question
| integer | $question_id The question id |
Definition at line 7002 of file class.ilObjTest.php.
References $res.
{
global $ilDB;
$res = "";
if ($question_id)
{
$query = sprintf("SELECT question_text FROM qpl_questions WHERE question_id = %s",
$ilDB->quote($question_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$res = $row["question_text"];
}
}
return $res;
}
| ilObjTest::getQuestionTitle | ( | $ | title | ) |
Returns the title of a test question.
Returns the title of a test question and checks if the title output is allowed. If not, the localized text "question" will be returned.
| string | $title The original title of the question |
Definition at line 3385 of file class.ilObjTest.php.
References ilObject::$title, and getTitleOutput().
Referenced by getTestResult().
{
if ($this->getTitleOutput() == 2)
{
return $this->lng->txt("ass_question");
}
else
{
return $title;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getQuestionTitles | ( | ) |
Returns the titles of the test questions in question sequence.
Returns the titles of the test questions in question sequence
Definition at line 3357 of file class.ilObjTest.php.
References isRandomTest().
{
$titles = array();
if (!$this->isRandomTest())
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($titles, $row["title"]);
}
}
return $titles;
}
Here is the call graph for this function:| ilObjTest::getQuestionType | ( | $ | question_id | ) |
Returns the question type of a question with a given id.
Returns the question type of a question with a given id
| integer | $question_id The database id of the question |
Definition at line 3464 of file class.ilObjTest.php.
References $data.
Referenced by createQuestionGUI().
{
global $ilDB;
if ($question_id < 1)
return -1;
$query = sprintf("SELECT type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
$ilDB->quote($question_id)
);
$result = $ilDB->query($query);
if ($result->numRows() == 1) {
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $data->type_tag;
} else {
return "";
}
}
Here is the caller graph for this function:| ilObjTest::getRandomQuestionCount | ( | ) |
Gets the number of random questions used for a random test.
Gets the number of random questions used for a random test
Definition at line 1988 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), generateRandomQuestions(), getQuestionCount(), isComplete(), and toXML().
{
return $this->random_question_count;
}
Here is the caller graph for this function:| ilObjTest::getRandomQuestionDuplicate | ( | $ | question_id, | |
| $ | active_id | |||
| ) |
Returns the question id of the duplicate of a question which is already in use in a random test.
Returns the question id of the duplicate of a question which is already in use in a random test
| integer | $question_id Question ID of the original question | |
| integer | $active_id Active ID of the user |
Definition at line 1529 of file class.ilObjTest.php.
Referenced by saveRandomQuestion().
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.question_id FROM qpl_questions, tst_test_random_question WHERE qpl_questions.original_id = %s AND tst_test_random_question.question_fi = qpl_questions.question_id AND tst_test_random_question.active_fi = %s",
$ilDB->quote($question_id . ""),
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$num = $result->numRows();
if ($num > 0)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["question_id"];
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| & ilObjTest::getRandomQuestionpools | ( | ) |
Returns an array containing the random questionpools saved to the database.
Returns an array containing the random questionpools saved to the database
public
Definition at line 1779 of file class.ilObjTest.php.
Referenced by generateRandomQuestions(), getQuestionCount(), and isComplete().
{
global $ilDB;
$qpls = array();
$counter = 0;
$query = sprintf("SELECT tst_test_random.*, qpl_questionpool.questioncount FROM tst_test_random, qpl_questionpool WHERE tst_test_random.test_fi = %s AND tst_test_random.questionpool_fi = qpl_questionpool.obj_fi ORDER BY test_random_id",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$qpls[$counter] = array(
"index" => $counter,
"count" => $row["num_of_q"],
"qpl" => $row["questionpool_fi"],
"contains" => $row["questioncount"]
);
$counter++;
}
}
return $qpls;
}
Here is the caller graph for this function:| ilObjTest::getRandomTest | ( | ) |
Gets the status of the $random_test attribute.
Gets the status of the $random_test attribute
Definition at line 1974 of file class.ilObjTest.php.
References isRandomTest().
Referenced by cloneObject().
{
return $this->isRandomTest();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getReportingDate | ( | ) |
Gets the reporting date.
Gets the reporting date of the ilObjTest object
Definition at line 2497 of file class.ilObjTest.php.
Referenced by addDefaults(), canEditMarks(), canViewResults(), cloneObject(), and toXML().
{
return $this->reporting_date;
}
Here is the caller graph for this function:| ilObjTest::getResetProcessingTime | ( | ) |
Returns wheather the processing time should be reset or not.
Returns wheather the processing time should be reset or not
Definition at line 2693 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), getStartingTimeOfUser(), isExecutable(), saveToDb(), and toXML().
{
return $this->reset_processing_time;
}
Here is the caller graph for this function:| ilObjTest::getResultsPresentation | ( | ) |
Returns the combined results presentation value.
Returns the combined results presentation value
Definition at line 8122 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->results_presentation;
}
Here is the caller graph for this function:| & ilObjTest::getRoleData | ( | $ | ids | ) |
Definition at line 7208 of file class.ilObjTest.php.
References getArrayData().
{
if (!is_array($ids) || count($ids) ==0)
return array();
$result_array = array();
$query = sprintf("SELECT obj_id, description, title FROM role_data, object_data o WHERE o.obj_id=role_id AND role_id IN ('%s')",
join ($ids,"','")
);
return $this->getArrayData ($query, "obj_id");
}
Here is the call graph for this function:| ilObjTest::getScoreCutting | ( | ) |
Determines if the score of a question should be cut at 0 points or the score of the whole test.
Determines if the score of a question should be cut at 0 points or the score of the whole test
Definition at line 2383 of file class.ilObjTest.php.
Referenced by cloneObject(), getTestResult(), saveToDb(), and toXML().
{
return $this->score_cutting;
}
Here is the caller graph for this function:| ilObjTest::getScoreReporting | ( | ) |
Gets the score reporting.
Gets the score reporting of the ilObjTest object
Definition at line 2275 of file class.ilObjTest.php.
Referenced by addDefaults(), canShowTestResults(), cloneObject(), and toXML().
{
return $this->score_reporting;
}
Here is the caller graph for this function:| ilObjTest::getSecondsUntilEndingTime | ( | ) |
Returns the seconds left from the actual time until the ending time.
Returns the seconds left from the actual time until the ending time
Definition at line 2656 of file class.ilObjTest.php.
References getEndingTime().
{
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndingTime(), $matches))
{
$ending = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = time();
return $ending - $now;
}
else
{
return 0;
}
}
Here is the call graph for this function:| ilObjTest::getSequenceSettings | ( | ) |
Gets the sequence settings.
Gets the sequence settings of the ilObjTest object
Definition at line 2261 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), and toXML().
{
return $this->sequence_settings;
}
Here is the caller graph for this function:| ilObjTest::getShowCancel | ( | ) |
Returns wheather the cancel test button is shown or not.
Returns wheather the cancel test button is shown or not
Definition at line 8787 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->show_cancel;
}
Here is the caller graph for this function:| ilObjTest::getShowMarker | ( | ) |
Returns wheather the marker button is shown or not.
Returns wheather the marker button is shown or not
Definition at line 8821 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->show_marker;
}
Here is the caller graph for this function:| ilObjTest::getShowPassDetails | ( | ) |
Returns if the pass details should be shown when a test is not finished.
Returns if the pass details should be shown when a test is not finished
Definition at line 8135 of file class.ilObjTest.php.
Referenced by setShowPassDetails().
{
if (($this->results_presentation & 1) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShowSolutionAnswersOnly | ( | ) |
Returns if the full solution (including ILIAS content) should be presented to the solution or not.
Returns if the full solution (including ILIAS content) should be presented to the solution or not
Definition at line 8215 of file class.ilObjTest.php.
Referenced by setShowSolutionAnswersOnly().
{
if (($this->results_presentation & 16) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShowSolutionDetails | ( | ) |
Returns if the solution details should be presented to the user or not.
Returns if the solution details should be presented to the user or not
Definition at line 8155 of file class.ilObjTest.php.
Referenced by setShowSolutionDetails().
{
if (($this->results_presentation & 2) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShowSolutionFeedback | ( | ) |
Returns if the feedback should be presented to the solution or not.
Returns if the feedback should be presented to the solution or not
Definition at line 8195 of file class.ilObjTest.php.
Referenced by setShowSolutionFeedback().
{
if (($this->results_presentation & 8) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShowSolutionPrintview | ( | ) |
Returns if the solution printview should be presented to the user or not.
Returns if the solution printview should be presented to the user or not
Definition at line 8175 of file class.ilObjTest.php.
Referenced by canShowSolutionPrintview(), and setShowSolutionPrintview().
{
if (($this->results_presentation & 4) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShowSolutionSignature | ( | ) |
Returns if the signature field should be shown in the test results.
Returns if the signature field should be shown in the test results
Definition at line 8235 of file class.ilObjTest.php.
Referenced by setShowSolutionSignature().
{
if (($this->results_presentation & 32) > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::getShuffleQuestions | ( | ) |
Returns the status of the shuffle_questions variable.
Returns the status of the shuffle_questions variable
Definition at line 7882 of file class.ilObjTest.php.
Referenced by cloneObject(), generateRandomQuestions(), saveToDb(), and toXML().
{
return $this->shuffle_questions;
}
Here is the caller graph for this function:| ilObjTest::getStartingTime | ( | ) |
Returns the starting time of the test.
Returns the starting time of the test
Definition at line 2707 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), isExecutable(), startingTimeReached(), and toXML().
{
return $this->starting_time;
}
Here is the caller graph for this function:| ilObjTest::getStartingTimeOfUser | ( | $ | active_id | ) |
Returns the unix timestamp of the time a user started a test.
Returns the unix timestamp of the time a user started a test
| integer | $active_id The active id of the user |
Definition at line 7799 of file class.ilObjTest.php.
References _getPass(), and getResetProcessingTime().
Referenced by canShowTestResults(), and isExecutable().
{
global $ilDB;
if ($active_id < 1) return FALSE;
$pass = ($this->getResetProcessingTime()) ? $this->_getPass($active_id) : 0;
$query = sprintf("SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches))
{
return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
}
else
{
return mktime();
}
}
else
{
return mktime();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getStartTestLabel | ( | $ | active_id | ) |
Returns the "Start the Test" label for the Info page.
Returns the "Start the Test" label for the Info page
| int | $active_id The active id of the current user |
Definition at line 8969 of file class.ilObjTest.php.
References $res, _getPass(), getNrOfResultsForPass(), and getNrOfTries().
{
if ($this->getNrOfTries() == 1)
{
return $this->lng->txt("tst_start_test");
}
$active_pass = $this->_getPass($active_id);
$res = $this->getNrOfResultsForPass($active_id, $active_pass);
if ($res == 0)
{
if ($active_pass == 0)
{
return $this->lng->txt("tst_start_test");
}
else
{
return $this->lng->txt("tst_start_new_test_pass");
}
}
else
{
return $this->lng->txt("tst_resume_test");
}
}
Here is the call graph for this function:| & ilObjTest::getTestDefaults | ( | $ | test_defaults_id | ) |
Returns the test defaults for a given id.
Returns the test defaults for a given id
| integer | $test_defaults_id The database id of a test defaults dataset |
Definition at line 9030 of file class.ilObjTest.php.
Referenced by applyDefaults().
{
global $ilDB;
$query = sprintf("SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
$ilDB->quote($test_defaults_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row;
}
else
{
return NULL;
}
}
Here is the caller graph for this function:| ilObjTest::getTestId | ( | ) |
Gets the database id of the additional test data.
Gets the database id of the additional test data
Definition at line 2016 of file class.ilObjTest.php.
Referenced by checkMaximumAllowedUsers(), createTestSession(), evalResultsOverview(), generateRandomQuestions(), getAccessCodeSession(), getActiveIdOfUser(), getCompleteWorkingTimeOfParticipants(), getVisitTimeOfParticipant(), removeSelectedTestResults(), removeTestResultsForUser(), saveCertificateVisibility(), saveECTSStatus(), setAccessCodeSession(), setTestSession(), and unsetAccessCodeSession().
{
return $this->test_id;
}
Here is the caller graph for this function:| & ilObjTest::getTestParticipants | ( | ) |
Returns a list of all participants in a test.
Returns a list of all participants in a test
Definition at line 7105 of file class.ilObjTest.php.
References $data, getAnonymity(), and getArrayData().
{
global $ilDB;
if ($this->getAnonymity())
{
$q = sprintf("SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi AS usr_id, '' AS login, %s AS lastname, '' AS firstname, tst_active.submitted as test_finished, usr_data.matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started ".
"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),
$ilDB->quote($this->lng->txt("unknown")),
$ilDB->quote($this->getTestId())
);
}
else
{
$q = sprintf("SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi AS usr_id, usr_data.login, usr_data.lastname, usr_data.firstname, tst_active.submitted as test_finished, usr_data.matriculation, IF(tst_active.active_id IS NULL,0,1) as test_started ".
"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),
$ilDB->quote($this->getTestId())
);
}
$data = $this->getArrayData($q, "active_id");
foreach ($data as $index => $participant)
{
if (strlen(trim($participant->firstname.$participant->lastname)) == 0)
{
$data[$index]->lastname = $this->lng->txt("deleted_user");
}
}
return $data;
}
Here is the call graph for this function:| & ilObjTest::getTestQuestions | ( | ) |
Definition at line 7859 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type, tst_test_question WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id AND tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY sequence",
$ilDB->quote($this->getTestId() . "")
);
$query_result = $ilDB->query($query);
$removableQuestions = array();
while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($removableQuestions, $row);
}
return $removableQuestions;
}
| & ilObjTest::getTestResult | ( | $ | active_id, | |
| $ | pass = NULL, |
|||
| $ | ordered_sequence = FALSE | |||
| ) |
Calculates the results of a test for a given user.
Calculates the results of a test for a given user and returns an array with all test results
Definition at line 3754 of file class.ilObjTest.php.
References $testSequence, assQuestion::_getInternalLinkHref(), assQuestion::_getMaximumPoints(), _getPass(), assQuestion::_getQuestionInfo(), assQuestion::_getReachedPoints(), assQuestion::_getSuggestedSolution(), assQuestion::_getSuggestedSolutionCount(), assQuestion::_isWorkedThrough(), getQuestionTitle(), getScoreCutting(), isRandomTest(), and ilUtil::prepareFormOutput().
Referenced by canShowCertificate(), evalStatistical(), getTotalPointsPassedArray(), and hideCorrectAnsweredQuestions().
{
// global $ilBench;
$total_max_points = 0;
$total_reached_points = 0;
$key = 1;
$result_array = array();
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$workedthrough = 0;
if (is_null($pass))
{
$pass = $this->_getPass($active_id);
}
include_once "./Modules/Test/classes/class.ilTestSequence.php";
$testSequence = new ilTestSequence($active_id, $pass, $this->isRandomTest());
$sequence = array();
if ($ordered_sequence)
{
$sequence = $testSequence->getOrderedSequence();
}
else
{
$sequence = $testSequence->getUserSequence();
}
foreach ($sequence as $sequenceindex)
{
$value = $testSequence->getQuestionForSequence($sequenceindex);
$max_points = assQuestion::_getMaximumPoints($value);
$total_max_points += $max_points;
$reached_points = assQuestion::_getReachedPoints($active_id, $value, $pass);
if (assQuestion::_isWorkedThrough($active_id, $value, $pass))
{
$workedthrough = 1;
}
else
{
$workedthrough = 0;
}
$total_reached_points += $reached_points;
if ($max_points > 0)
{
$percentvalue = $reached_points / $max_points;
}
else
{
$percentvalue = 0;
}
if ($percentvalue < 0) $percentvalue = 0.0;
if (assQuestion::_getSuggestedSolutionCount($value) == 1)
{
$solution_array =& assQuestion::_getSuggestedSolution($value, 0);
$href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
}
elseif (assQuestion::_getSuggestedSolutionCount($value) > 1)
{
$href = "see_details_for_further_information";
}
else
{
$href = "";
}
$info =& assQuestion::_getQuestionInfo($value);
include_once "./Services/Utilities/classes/class.ilUtil.php";
$row = array(
"nr" => "$key",
"title" => ilUtil::prepareFormOutput($this->getQuestionTitle($info["title"])),
"max" => $max_points,
"reached" => $reached_points,
"percent" => sprintf("%2.2f ", ($percentvalue) * 100) . "%",
"solution" => $href,
"type" => $info["type_tag"],
"qid" => $value,
"original_id" => $info["original_id"],
"workedthrough" => $workedthrough
);
array_push($result_array, $row);
$key++;
}
if ($this->getScoreCutting() == 1)
{
if ($total_reached_points < 0)
{
$total_reached_points = 0;
}
}
$result_array["test"]["total_max_points"] = $total_max_points;
$result_array["test"]["total_reached_points"] = $total_reached_points;
if ((!$total_reached_points) or (!$total_max_points))
{
$percentage = 0.0;
}
else
{
$percentage = ($total_reached_points / $total_max_points) * 100.0;
if ($percentage < 0) $percentage = 0.0;
}
$mark_obj = $this->mark_schema->getMatchingMark($percentage);
$passed = "";
if ($mark_obj)
{
if ($mark_obj->getPassed())
{
$passed = 1;
}
else
{
$passed = 0;
}
}
$result_array["test"]["passed"] = $passed;
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getTestSequence | ( | $ | active_id = "", |
|
| $ | pass = "" | |||
| ) |
Definition at line 9374 of file class.ilObjTest.php.
References getTestSession(), and isRandomTest().
Referenced by hideCorrectAnsweredQuestions().
{
if (is_object($this->testSequence) && ($this->testSequence->getActiveId() > 0)) return $this->testSequence;
include_once "./Modules/Test/classes/class.ilTestSequence.php";
if (($active_id > 0) && (strlen($pass)))
{
$this->testSequence = new ilTestSequence($active_id, $pass, $this->isRandomTest());
}
else
{
$this->testSequence = new ilTestSequence($this->getTestSession()->getActiveId(), $this->getTestSession()->getPass(), $this->isRandomTest());
}
return $this->testSequence;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getTestSession | ( | $ | active_id = "" |
) |
Returns the test session data for the active user.
Definition at line 9357 of file class.ilObjTest.php.
References setTestSession().
Referenced by canShowTestResults(), getTestSequence(), hideCorrectAnsweredQuestions(), and isExecutable().
{
if (is_object($this->testSession) && ($this->testSession->getActiveId() > 0)) return $this->testSession;
return $this->setTestSession($active_id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getTextAnswer | ( | $ | active_id, | |
| $ | question_id, | |||
| $ | pass = NULL | |||
| ) |
Returns the text answer of a given user for a given question.
Returns the text answer of a given user for a given question
| integer | $user_id The user id | |
| integer | $question_id The question id |
Definition at line 6966 of file class.ilObjTest.php.
References $res, and assQuestion::_getSolutionMaxPass().
{
global $ilDB;
$res = "";
if (($active_id) && ($question_id))
{
if (is_null($pass))
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
}
$query = sprintf("SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$res = $row["value1"];
}
}
return $res;
}
Here is the call graph for this function:| ilObjTest::getTitleOutput | ( | ) |
Returns the value of the title_output status.
Returns the value of the title_output status
Definition at line 2539 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), getQuestionTitle(), saveToDb(), and toXML().
{
return $this->title_output;
}
Here is the caller graph for this function:| & ilObjTest::getTotalPointsPassedArray | ( | ) |
Returns an array with the total points of all users who passed the test.
Returns an array with the total points of all users who passed the test This array could be used for statistics
Definition at line 4166 of file class.ilObjTest.php.
References $total, evalTotalParticipantsArray(), and getTestResult().
Referenced by getECTSGrade().
{
$totalpoints_array = array();
$all_users =& $this->evalTotalParticipantsArray();
foreach ($all_users as $active_id => $user_name)
{
$test_result =& $this->getTestResult($active_id);
$reached = $test_result["test"]["total_reached_points"];
$total = $test_result["test"]["total_max_points"];
$percentage = $total != 0 ? $reached/$total : 0;
$mark = $this->mark_schema->getMatchingMark($percentage*100.0);
if ($mark)
{
if ($mark->getPassed())
{
array_push($totalpoints_array, $test_result["test"]["total_reached_points"]);
}
}
}
return $totalpoints_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getUnfilteredEvaluationData | ( | ) |
Definition at line 4461 of file class.ilObjTest.php.
References $data, buildName(), getCompleteWorkingTimeOfParticipants(), getECTSGrade(), getPassScoring(), getQuestionCount(), getVisitTimeOfParticipant(), and isRandomTest().
Referenced by getCompleteEvaluationData().
{
global $ilDB;
include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
$data = new ilTestEvaluationData();
$query = sprintf("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_test_result.*, qpl_questions.original_id, qpl_questions.title AS questiontitle, " .
"qpl_questions.points AS maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s " .
"ORDER BY usr_data.lastname, usr_data.firstname, active_id, pass, TIMESTAMP",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
$pass = NULL;
$checked = array();
$datasets = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$datasets++;
$remove = FALSE;
if (!$remove)
{
if (!$data->participantExists($row["active_fi"]))
{
$data->addParticipant($row["active_fi"], new ilTestEvaluationUserData());
$data->getParticipant($row["active_fi"])->setName($this->buildName($row["usr_id"], $row["firstname"], $row["lastname"], $row["title"]));
$data->getParticipant($row["active_fi"])->setLogin($row["login"]);
$data->getParticipant($row["active_fi"])->setUserID($row["usr_id"]);
}
if (!is_object($data->getParticipant($row["active_fi"])->getPass($row["pass"])))
{
$pass = new ilTestEvaluationPassData();
$pass->setPass($row["pass"]);
$data->getParticipant($row["active_fi"])->addPass($row["pass"], $pass);
}
$data->getParticipant($row["active_fi"])->getPass($row["pass"])->addAnsweredQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["maxpoints"], $row["points"]);
}
}
$data->setDatasets($datasets);
foreach (array_keys($data->getParticipants()) as $active_id)
{
if ($this->isRandomTest())
{
for ($testpass = 0; $testpass <= $data->getParticipant($active_id)->getLastPass(); $testpass++)
{
$query = sprintf("SELECT tst_test_random_question.sequence, tst_test_random_question.question_fi, qpl_questions.original_id, " .
"tst_test_random_question.pass, qpl_questions.points, qpl_questions.title " .
"FROM tst_test_random_question, qpl_questions " .
"WHERE tst_test_random_question.question_fi = qpl_questions.question_id " .
"AND tst_test_random_question.pass = %s " .
"AND tst_test_random_question.active_fi = %s ORDER BY tst_test_random_question.sequence LIMIT 0, %s",
$ilDB->quote($testpass . ""),
$ilDB->quote($active_id . ""),
$this->getQuestionCount()
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$tpass = array_key_exists("pass", $row) ? $row["pass"] : 0;
$data->getParticipant($active_id)->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $tpass);
$data->addQuestionTitle($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["title"]);
}
}
}
}
else
{
$query = sprintf("SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
"qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
"FROM tst_test_question, tst_active, qpl_questions " .
"WHERE tst_test_question.question_fi = qpl_questions.question_id " .
"AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$questionsbysequence = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$questionsbysequence[$row["sequence"]] = $row;
}
$sequery = sprintf("SELECT * FROM tst_sequence WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$seqresult = $ilDB->query($sequery);
while ($seqrow = $seqresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$questionsequence = unserialize($seqrow["sequence"]);
foreach ($questionsequence as $sidx => $seq)
{
$qsid = $questionsbysequence[$seq]["original_id"] ? $questionsbysequence[$seq]["original_id"] : $questionsbysequence[$seq]["question_fi"];
$data->getParticipant($active_id)->addQuestion($qsid, $questionsbysequence[$seq]["points"], $sidx + 1, $seqrow["pass"]);
$data->addQuestionTitle($qsid, $questionsbysequence[$seq]["title"]);
}
}
}
}
}
$workingTimes =& $this->getCompleteWorkingTimeOfParticipants();
foreach (array_keys($data->getParticipants()) as $active_id)
{
$tpass = 0;
if ($this->getPassScoring() == SCORE_BEST_PASS)
{
$tpass = $data->getParticipant($active_id)->getBestPass();
}
else
{
$tpass = $data->getParticipant($active_id)->getLastPass();
}
$data->getParticipant($active_id)->setReached($data->getParticipant($active_id)->getReachedPoints($tpass));
$data->getParticipant($active_id)->setMaxPoints($data->getParticipant($active_id)->getAvailablePoints($tpass));
$percentage = $data->getParticipant($active_id)->getMaxPoints() ? $data->getParticipant($active_id)->getReached() / $data->getParticipant($active_id)->getMaxPoints() * 100.0 : 0;
$mark = $this->mark_schema->getMatchingMark($percentage);
if (is_object($mark))
{
$data->getParticipant($active_id)->setMark($mark->getShortName());
$data->getParticipant($active_id)->setMarkOfficial($mark->getOfficialName());
$data->getParticipant($active_id)->setPassed($mark->getPassed());
}
if ($this->ects_output)
{
// TODO: This is a performance killer!!!!
$ects_mark = $this->getECTSGrade($data->getParticipant($active_id)->getReached(), $data->getParticipant($active_id)->getMaxPoints());
$data->getParticipant($active_id)->setECTSMark($ects_mark);
}
if (is_object($data->getParticipant($active_id)->getPass($tpass)))
{
$data->getParticipant($active_id)->setQuestionsWorkedThrough($data->getParticipant($active_id)->getPass($tpass)->getAnsweredQuestionCount());
}
$questionpass = $tpass;
if (!is_array($data->getParticipant($active_id)->getQuestions($tpass)))
{
$questionpass = 0;
}
$data->getParticipant($active_id)->setNumberOfQuestions(count($data->getParticipant($active_id)->getQuestions($questionpass)));
$data->getParticipant($active_id)->setTimeOfWork($workingTimes[$active_id]);
$visitingTime =& $this->getVisitTimeOfParticipant($active_id);
$data->getParticipant($active_id)->setFirstVisit($visitingTime["firstvisit"]);
$data->getParticipant($active_id)->setLastVisit($visitingTime["lastvisit"]);
}
return $data;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getUsePreviousAnswers | ( | ) |
Returns if the previous answers should be shown for a learner.
Returns if the previous answers should be shown for a learner
Definition at line 2525 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), saveToDb(), and toXML().
{
return $this->use_previous_answers;
}
Here is the caller graph for this function:| & ilObjTest::getUserData | ( | $ | ids | ) |
Returns a data of all users specified by id list.
Returns a data of all users specified by id list
| $usr_ids | kommaseparated list of ids |
Definition at line 7144 of file class.ilObjTest.php.
References getAnonymity(), and getArrayData().
{
if (!is_array($ids) || count($ids) ==0)
return array();
$result_array = array();
if ($this->getAnonymity())
{
$query = sprintf("SELECT usr_id, '' AS login, %s AS lastname, '' AS firstname, client_ip as clientip FROM usr_data WHERE usr_id IN ('%s') ORDER BY login",
$ilDB->quote($this->lng->txt("unknown")),
join ($ids,"','")
);
}
else
{
$query = sprintf("SELECT usr_id, login, lastname, firstname, client_ip as clientip FROM usr_data WHERE usr_id IN ('%s') ORDER BY login",
join ($ids,"','")
);
}
return $this->getArrayData ($query, "usr_id");
}
Here is the call graph for this function:| ilObjTest::getVisitTimeOfParticipant | ( | $ | active_id | ) |
Returns the first and last visit of a participant.
Returns the first and last visit of a participant
| integer | $active_id The active ID of the participant |
Definition at line 4004 of file class.ilObjTest.php.
References _getVisitTimeOfParticipant(), and getTestId().
Referenced by getUnfilteredEvaluationData().
{
return ilObjTest::_getVisitTimeOfParticipant($this->getTestId(), $active_id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getWorkedQuestions | ( | $ | active_id, | |
| $ | pass = NULL | |||
| ) |
Gets the id's of all questions a user already worked through.
Gets the id's of all questions a user already worked through
Definition at line 3531 of file class.ilObjTest.php.
{
global $ilUser;
global $ilDB;
if (is_null($pass))
{
$query = sprintf("SELECT * FROM tst_solutions WHERE active_fi = %s AND pass = 0 GROUP BY question_fi",
$ilDB->quote($active_id . "")
);
}
else
{
$query = sprintf("SELECT * FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
}
$result = $ilDB->query($query);
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
array_push($result_array, $row->question_fi);
}
return $result_array;
}
| ilObjTest::hasNrOfTriesRestriction | ( | ) |
returns if the numbers of tries have to be checked
Definition at line 7394 of file class.ilObjTest.php.
References getNrOfTries().
Referenced by isExecutable().
{
return $this->getNrOfTries() != 0;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::hasRandomQuestionsForPass | ( | $ | active_id, | |
| $ | pass | |||
| ) |
Checkes wheather a random test has already created questions for a given pass or not.
Checkes wheather a random test has already created questions for a given pass or not
private
| $active_id | Active id of the test | |
| $pass | Pass of the test |
Definition at line 1579 of file class.ilObjTest.php.
Referenced by generateRandomQuestions().
{
global $ilDB;
$query = sprintf("SELECT test_random_question_id FROM tst_test_random_question WHERE active_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows() > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::hideCorrectAnsweredQuestions | ( | ) |
Definition at line 9390 of file class.ilObjTest.php.
References getTestResult(), getTestSequence(), and getTestSession().
{
if ($this->getTestSession()->getActiveId() > 0)
{
$result = $this->getTestResult($this->getTestSession()->getActiveId(), $this->getTestSession()->getPass(), TRUE);
foreach ($result as $sequence => $question)
{
if (is_numeric($sequence))
{
if ($question["reached"] == $question["max"])
{
$this->getTestSequence()->hideQuestion($question["qid"]);
}
}
}
$this->getTestSequence()->saveToDb();
}
}
Here is the call graph for this function:| ilObjTest::ilObjTest | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = true | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 428 of file class.ilObjTest.php.
References ilObject::$lng, ilObject::ilObject(), setShowPassDetails(), setShowSolutionAnswersOnly(), setShowSolutionDetails(), and setShowSolutionSignature().
Referenced by _isComplete().
{
global $ilUser;
$this->type = "tst";
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$this->mark_schema = new ASS_MarkSchema();
$this->test_id = -1;
$this->author = $ilUser->fullname;
$this->introduction = "";
$this->questions = array();
$this->sequence_settings = TEST_FIXED_SEQUENCE;
$this->score_reporting = REPORT_AFTER_TEST;
$this->instant_verification = 0;
$this->answer_feedback_points = 0;
$this->reporting_date = "";
$this->nr_of_tries = 0;
$this->use_previous_answers = 1;
$this->title_output = 0;
$this->starting_time = "";
$this->ending_time = "";
$this->processing_time = "00:00:00";
$this->enable_processing_time = "0";
$this->reset_processing_time = 0;
$this->ects_output = 0;
$this->ects_fx = "";
$this->random_test = 0;
$this->shuffle_questions = FALSE;
$this->show_summary = 8;
$this->random_question_count = "";
$this->count_system = COUNT_PARTIAL_SOLUTIONS;
$this->mc_scoring = SCORE_ZERO_POINTS_WHEN_UNANSWERED;
$this->score_cutting = SCORE_CUT_QUESTION;
$this->pass_scoring = SCORE_LAST_PASS;
$this->answer_feedback = 0;
$this->password = "";
$this->certificate_visibility = 0;
$this->allowedUsers = "";
$this->allowedUsersTimeGap = "";
$this->anonymity = 0;
$this->show_cancel = 1;
$this->show_marker = 0;
$this->fixed_participants = 0;
$this->setShowPassDetails(TRUE);
$this->setShowSolutionDetails(TRUE);
$this->setShowSolutionAnswersOnly(FALSE);
$this->setShowSolutionSignature(TRUE);
$this->testSession = FALSE;
$this->testSequence = FALSE;
global $lng;
$lng->loadLanguageModule("assessment");
$this->mark_schema->createSimpleSchema($lng->txt("failed_short"), $lng->txt("failed_official"), 0, 0, $lng->txt("passed_short"), $lng->txt("passed_official"), 50, 1);
$this->ects_grades = array(
"A" => 90,
"B" => 65,
"C" => 35,
"D" => 10,
"E" => 0
);
$this->ilObject($a_id, $a_call_by_reference);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::initDefaultRoles | ( | ) |
init default roles settings
If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)
public
Reimplemented from ilObject.
Definition at line 681 of file class.ilObjTest.php.
{
global $rbacadmin;
// create a local role folder
//$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
// create moderator role and assign role to rolefolder...
//$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
//$roles[] = $roleObj->getId();
//unset($rfoldObj);
//unset($roleObj);
return $roles ? $roles : array();
}
| ilObjTest::insertQuestion | ( | $ | question_id | ) |
Insert a question in the list of questions.
Insert a question in the list of questions
| integer | $question_id The database id of the inserted question public |
Definition at line 3302 of file class.ilObjTest.php.
References $data, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), duplicateQuestionForTest(), loadQuestions(), logAction(), and saveCompleteStatus().
{
global $ilDB;
$duplicate_id = $this->duplicateQuestionForTest($question_id);
// get maximum sequence index in test
$query = sprintf("SELECT MAX(sequence) AS seq FROM tst_test_question WHERE test_fi=%s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$sequence = 1;
if ($result->numRows() == 1)
{
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$sequence = $data->seq + 1;
}
$query = sprintf("INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$ilDB->quote($this->getTestId()),
$ilDB->quote($duplicate_id),
$ilDB->quote($sequence)
);
$result = $ilDB->query($query);
if ($result != DB_OK)
{
// Error
}
else
{
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_added", ilObjAssessmentFolder::_getLogLanguage()) . ": " . $sequence, $duplicate_id);
}
}
// remove test_active entries, because test has changed
$query = sprintf("DELETE FROM tst_active WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$this->loadQuestions();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::inviteGroup | ( | $ | group_id | ) |
Invites all users of a group to a test.
Invites all users of a group to a test
| integer | $group_id The database id of the invited group public |
Definition at line 7231 of file class.ilObjTest.php.
References ilObjUser::_lookupClientIP(), and inviteUser().
{
include_once "./classes/class.ilObjGroup.php";
$group = new ilObjGroup($group_id);
$members = $group->getGroupMemberIds();
include_once './Services/User/classes/class.ilObjUser.php';
foreach ($members as $user_id)
{
$this->inviteUser($user_id, ilObjUser::_lookupClientIP($user_id));
}
}
Here is the call graph for this function:| ilObjTest::inviteRole | ( | $ | role_id | ) |
Invites all users of a role to a test.
Invites all users of a role to a test
| integer | $group_id The database id of the invited group public |
Definition at line 7251 of file class.ilObjTest.php.
References ilObjUser::_lookupClientIP(), and inviteUser().
{
global $rbacreview;
$members = $rbacreview->assignedUsers($role_id,"usr_id");
include_once './Services/User/classes/class.ilObjUser.php';
foreach ($members as $user_id)
{
$this->inviteUser($user_id, ilObjUser::_lookupClientIP($user_id));
}
}
Here is the call graph for this function:| ilObjTest::inviteUser | ( | $ | user_id, | |
| $ | client_ip = "" | |||
| ) |
Invites a user to a test.
Invites a user to a test
| integer | $user_id The database id of the invited user public |
Definition at line 7291 of file class.ilObjTest.php.
Referenced by inviteGroup(), and inviteRole().
{
global $ilDB;
$query = sprintf("INSERT IGNORE INTO tst_invited_user (test_fi, user_fi, clientip) VALUES (%s, %s, %s)",
$ilDB->quote($this->test_id),
$ilDB->quote($user_id),
$ilDB->quote($client_ip)
);
$result = $ilDB->query($query);
}
Here is the caller graph for this function:| ilObjTest::isAccessCodeUsed | ( | $ | code | ) |
Definition at line 8465 of file class.ilObjTest.php.
Referenced by createNewAccessCode().
{
global $ilDB;
$query = sprintf("SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($code . "")
);
$result = $ilDB->query($query);
if ($result->numRows() > 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::isActiveTestSubmitted | ( | $ | user_id = null |
) |
returns if the active for user_id has been submitted
Definition at line 7374 of file class.ilObjTest.php.
{
global $ilUser;
global $ilDB;
if (!is_numeric($user_id))
$user_id = $ilUser->getId();
$query = sprintf("SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=1",
$ilDB->quote($this->test_id),
$ilDB->quote($user_id)
);
$result = $ilDB->query($query);
return $result->numRows() == 1;
}
| ilObjTest::isComplete | ( | ) |
Returns true, if a test is complete for use.
Returns true, if a test is complete for use
Definition at line 989 of file class.ilObjTest.php.
References getRandomQuestionCount(), getRandomQuestionpools(), and isRandomTest().
Referenced by saveCompleteStatus(), and saveToDb().
{
if ((count($this->mark_schema->mark_steps)) and (count($this->questions)))
{
return true;
}
else
{
if ($this->isRandomTest())
{
$arr = $this->getRandomQuestionpools();
if (count($arr) && ($this->getRandomQuestionCount() > 0))
{
return true;
}
$count = 0;
foreach ($arr as $array)
{
$count += $array["count"];
}
if ($count)
{
return true;
}
}
return false;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::isExecutable | ( | $ | user_id, | |
| $ | allowPassIncrease = FALSE | |||
| ) |
Checks if the test is executable by the given user.
Checks if the test is executable by the given user
| integer | $user_id The user id |
Definition at line 7643 of file class.ilObjTest.php.
References $starting_time, _getPass(), endingTimeReached(), ilFormat::ftimestamp2datetimeDB(), getActiveIdOfUser(), getEnableProcessingTime(), getEndingTime(), getNrOfTries(), getResetProcessingTime(), getStartingTime(), getStartingTimeOfUser(), getTestSession(), hasNrOfTriesRestriction(), isMaxProcessingTimeReached(), isNrOfTriesReached(), and startingTimeReached().
{
$result = array(
"executable" => true,
"errormessage" => ""
);
if (!$this->startingTimeReached())
{
$result["executable"] = false;
$result["errormessage"] = sprintf($this->lng->txt("detail_starting_time_not_reached"), ilFormat::ftimestamp2datetimeDB($this->getStartingTime()));
return $result;
}
if ($this->endingTimeReached())
{
$result["executable"] = false;
$result["errormessage"] = sprintf($this->lng->txt("detail_ending_time_reached"), ilFormat::ftimestamp2datetimeDB($this->getEndingTime()));
return $result;
}
$active_id = $this->getActiveIdOfUser($user_id);
if ($this->getEnableProcessingTime())
{
if ($active_id > 0)
{
$starting_time = $this->getStartingTimeOfUser($active_id);
if ($starting_time !== FALSE)
{
if ($this->isMaxProcessingTimeReached($starting_time))
{
if ($allowPassIncrease && $this->getResetProcessingTime() && (($this->getNrOfTries() == 0) || ($this->getNrOfTries() > ($this->_getPass($active_id)+1))))
{
// a test pass was quitted because the maximum processing time was reached, but the time
// will be resetted for future passes, so if there are more passes allowed, the participant may
// start the test again.
// This code block is only called when $allowPassIncrease is TRUE which only happens when
// the test info page is opened. Otherwise this will lead to unexpected results!
$this->getTestSession()->increasePass();
$this->getTestSession()->setLastSequence(0);
$this->getTestSession()->saveToDb();
}
else
{
$result["executable"] = false;
$result["errormessage"] = $this->lng->txt("detail_max_processing_time_reached");
}
return $result;
}
}
}
}
if ($this->hasNrOfTriesRestriction() && ($active_id > 0) && $this->isNrOfTriesReached($this->getTestSession($active_id)->getPass()))
{
$result["executable"] = false;
$result["errormessage"] = $this->lng->txt("maximum_nr_of_tries_reached");
return $result;
}
if ($this->getTestSession($active_id)->isSubmitted())
{
$result["executable"] = FALSE;
$result["errormessage"] = $this->lng->txt("maximum_nr_of_tries_reached");
return $result;
}
// TODO: max. processing time
return $result;
}
Here is the call graph for this function:| ilObjTest::isHTML | ( | $ | a_text | ) |
Checks if a given string contains HTML or not.
| string | $a_text Text which should be checked |
Definition at line 8607 of file class.ilObjTest.php.
Referenced by addQTIMaterial().
{
if (preg_match("/<[^>]*?>/", $a_text))
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::isMaxProcessingTimeReached | ( | $ | starting_time | ) |
Returns wheather the maximum processing time for a test is reached or not.
Returns wheather the maximum processing time for a test is reached or not
| long | $starting_time The unix timestamp of the starting time of the test |
Definition at line 7838 of file class.ilObjTest.php.
References $processing_time, $starting_time, getEnableProcessingTime(), and getProcessingTimeInSeconds().
Referenced by canShowTestResults(), and isExecutable().
{
if ($this->getEnableProcessingTime())
{
$processing_time = $this->getProcessingTimeInSeconds();
$now = mktime();
if ($now > ($starting_time + $processing_time))
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::isNrOfTriesReached | ( | $ | tries | ) |
returns if number of tries are reached
Definition at line 7404 of file class.ilObjTest.php.
References getNrOfTries().
Referenced by isExecutable().
{
return $tries >= (int) $this->getNrOfTries();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::isRandomTest | ( | ) |
Gets the status of the $random_test attribute.
Gets the status of the $random_test attribute
Definition at line 1960 of file class.ilObjTest.php.
Referenced by addDefaults(), cloneObject(), createTestSequence(), getAllQuestions(), getAnsweredQuestionCount(), getExistingQuestions(), getQuestionCount(), getQuestionsOfPass(), getQuestionsOfTest(), getQuestionTitles(), getRandomTest(), getTestResult(), getTestSequence(), getUnfilteredEvaluationData(), isComplete(), loadQuestions(), removeAllTestEditings(), removeSelectedTestResults(), removeTestResultsForUser(), saveToDb(), and toXML().
{
return $this->random_test;
}
Here is the caller graph for this function:| ilObjTest::isTestFinishedToViewResults | ( | $ | active_id, | |
| $ | currentpass | |||
| ) |
Returns true if an active user completed a test pass and did not start a new pass.
Returns true if an active user completed a test pass and did not start a new pass
| integer | $active_id The active id of the user | |
| integer | $currentpass The current test pass of the user |
Definition at line 3568 of file class.ilObjTest.php.
References getPassFinishDate().
Referenced by canShowTestResults().
{
$num = $this->getPassFinishDate($active_id, $currentpass);
if (($currentpass > 0) && ($num == 0))
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::loadFromDb | ( | ) |
Loads a ilObjTest object from a database.
Loads a ilObjTest object from a database
| object | $db A pear DB object | |
| integer | $test_id A unique key which defines the test in the database public |
Definition at line 1814 of file class.ilObjTest.php.
References $data, ilRTE::_replaceMediaObjectImageSrc(), getAuthor(), loadQuestions(), saveAuthorToMetadata(), setAllowedUsers(), setAllowedUsersTimeGap(), setCertificateVisibility(), setListOfQuestionsSettings(), setPassScoring(), setPassword(), setResultsPresentation(), setScoreCutting(), setShuffleQuestions(), setTitleOutput(), and setUsePreviousAnswers().
Referenced by cloneObject(), and read().
{
global $ilDB;
$query = sprintf("SELECT * FROM tst_tests WHERE obj_fi = %s",
$ilDB->quote($this->getId())
);
$result = $ilDB->query($query);
if (strcmp(strtolower(get_class($result)), db_result) == 0)
{
if ($result->numRows() == 1)
{
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$this->test_id = $data->test_id;
if (strlen($this->getAuthor()) == 0)
{
$this->saveAuthorToMetadata($data->author);
}
$this->author = $this->getAuthor();
include_once("./Services/RTE/classes/class.ilRTE.php");
$this->introduction = ilRTE::_replaceMediaObjectImageSrc($data->introduction, 1);
$this->sequence_settings = $data->sequence_settings;
$this->score_reporting = $data->score_reporting;
$this->instant_verification = $data->instant_verification;
$this->answer_feedback_points = $data->answer_feedback_points;
$this->answer_feedback = $data->answer_feedback;
$this->anonymity = $data->anonymity;
$this->show_cancel = $data->show_cancel;
$this->show_marker = $data->show_marker;
$this->fixed_participants = $data->fixed_participants;
$this->nr_of_tries = $data->nr_of_tries;
$this->setUsePreviousAnswers($data->use_previous_answers);
$this->setTitleOutput($data->title_output);
$this->processing_time = $data->processing_time;
$this->enable_processing_time = $data->enable_processing_time;
$this->reset_processing_time = $data->reset_processing_time;
$this->reporting_date = $data->reporting_date;
$this->setShuffleQuestions($data->shuffle_questions);
$this->setResultsPresentation($data->results_presentation);
$this->setListOfQuestionsSettings($data->show_summary);
$this->starting_time = $data->starting_time;
$this->ending_time = $data->ending_time;
$this->ects_output = $data->ects_output;
$this->ects_grades = array(
"A" => $data->ects_a,
"B" => $data->ects_b,
"C" => $data->ects_c,
"D" => $data->ects_d,
"E" => $data->ects_e
);
$this->ects_fx = $data->ects_fx;
$this->random_test = $data->random_test;
$this->random_question_count = $data->random_question_count;
$this->mark_schema->flush();
$this->mark_schema->loadFromDb($this->test_id);
$this->count_system = $data->count_system;
$this->mc_scoring = $data->mc_scoring;
$this->setScoreCutting($data->score_cutting);
$this->setPassword($data->password);
$this->setAllowedUsers($data->allowedUsers);
$this->setAllowedUsersTimeGap($data->allowedUsersTimeGap);
$this->setPassScoring($data->pass_scoring);
$this->setCertificateVisibility($data->certificate_visibility);
$this->loadQuestions();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::loadQuestions | ( | $ | active_id = "", |
|
| $ | pass = NULL | |||
| ) |
Load the test question id's from the database.
Load the test question id's from the database
| integer | $user_id The user id of the test user (necessary for random tests) public |
Definition at line 1890 of file class.ilObjTest.php.
References $data, _getPass(), getActiveIdOfUser(), and isRandomTest().
Referenced by getAllQuestions(), getAnsweredQuestionCount(), insertQuestion(), loadFromDb(), questionMoveDown(), questionMoveUp(), and removeQuestion().
{
global $ilUser;
global $ilDB;
$this->questions = array();
if (strcmp($active_id, "") == 0)
{
$active_id = $this->getActiveIdOfUser($ilUser->getId());
}
if ($this->isRandomTest())
{
if (is_null($pass))
{
$pass = $this->_getPass($active_id);
}
$query = sprintf("SELECT tst_test_random_question.* FROM tst_test_random_question, qpl_questions WHERE tst_test_random_question.active_fi = %s AND qpl_questions.question_id = tst_test_random_question.question_fi AND tst_test_random_question.pass = %s ORDER BY sequence",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
// The following is a fix for random tests prior to ILIAS 3.8. If someone started a random test in ILIAS < 3.8, there
// is only one test pass (pass = 0) in tst_test_random_question while with ILIAS 3.8 there are questions for every test pass.
// To prevent problems with tests started in an older version and continued in ILIAS 3.8, the first pass should be taken if
// no questions are present for a newer pass.
if ($result->numRows() == 0)
{
$query = sprintf("SELECT tst_test_random_question.* FROM tst_test_random_question, qpl_questions WHERE tst_test_random_question.active_fi = %s AND qpl_questions.question_id = tst_test_random_question.question_fi AND tst_test_random_question.pass = 0 ORDER BY sequence",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
}
}
else
{
$query = sprintf("SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
$ilDB->quote($this->test_id . "")
);
$result = $ilDB->query($query);
}
$index = 1;
while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->questions[$index++] = $data->question_fi;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::logAction | ( | $ | logtext = "", |
|
| $ | question_id = "" | |||
| ) |
Logs an action into the Test&Assessment log.
Logs an action into the Test&Assessment log
| string | $logtext The log text | |
| integer | $question_id If given, saves the question id to the database public |
Definition at line 6867 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_addLog(), assQuestion::_getOriginalId(), ilObject::getId(), and ilObject::getRefId().
Referenced by checkMaximumAllowedUsers(), insertQuestion(), questionMoveDown(), questionMoveUp(), removeAllTestEditings(), removeQuestion(), removeSelectedTestResults(), removeTestResultsForUser(), saveQuestionsToDb(), saveRandomQuestionCount(), saveRandomQuestionpools(), and saveToDb().
{
global $ilUser;
$original_id = "";
if (strcmp($question_id, "") != 0)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$original_id = assQuestion::_getOriginalId($question_id);
}
include_once "./classes/class.ilObjAssessmentFolder.php";
ilObjAssessmentFolder::_addLog($ilUser->getId(), $this->getId(), $logtext, $question_id, $original_id, TRUE, $this->getRefId());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::modifyExportIdentifier | ( | $ | a_tag, | |
| $ | a_param, | |||
| $ | a_value | |||
| ) |
Returns the installation id for a given identifier.
Returns the installation id for a given identifier
private
Definition at line 6173 of file class.ilObjTest.php.
References ilUtil::insertInstIntoID().
{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$a_value = ilUtil::insertInstIntoID($a_value);
}
return $a_value;
}
Here is the call graph for this function:| ilObjTest::moveQuestions | ( | $ | move_questions, | |
| $ | target_index, | |||
| $ | insert_mode | |||
| ) |
Move questions to another position.
Move questions to another position
| array | $move_questions An array with the question id's of the questions to move | |
| integer | $target_index The question id of the target position | |
| integer | $insert_mode 0, if insert before the target position, 1 if insert after the target position public |
Definition at line 5351 of file class.ilObjTest.php.
References saveQuestionsToDb().
{
$this->questions = array_values($this->questions);
$array_pos = array_search($target_index, $this->questions);
if ($insert_mode == 0)
{
$part1 = array_slice($this->questions, 0, $array_pos);
$part2 = array_slice($this->questions, $array_pos);
}
else if ($insert_mode == 1)
{
$part1 = array_slice($this->questions, 0, $array_pos + 1);
$part2 = array_slice($this->questions, $array_pos + 1);
}
foreach ($move_questions as $question_id)
{
if (!(array_search($question_id, $part1) === FALSE))
{
unset($part1[array_search($question_id, $part1)]);
}
if (!(array_search($question_id, $part2) === FALSE))
{
unset($part2[array_search($question_id, $part2)]);
}
}
$part1 = array_values($part1);
$part2 = array_values($part2);
$new_array = array_values(array_merge($part1, $move_questions, $part2));
$this->questions = array();
$counter = 1;
foreach ($new_array as $question_id)
{
$this->questions[$counter] = $question_id;
$counter++;
}
$this->saveQuestionsToDb();
}
Here is the call graph for this function:| ilObjTest::notify | ( | $ | a_event, | |
| $ | a_ref_id, | |||
| $ | a_parent_non_rbac_id, | |||
| $ | a_node_id, | |||
| $ | a_params = 0 | |||
| ) |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)
public
| string | event | |
| integer | reference id of object where the event occured | |
| array | passes optional parameters if required |
Reimplemented from ilObject.
Definition at line 711 of file class.ilObjTest.php.
References $_GET, and ilObject::getType().
{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
//exit;
break;
case "cut":
//echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
//exit;
break;
case "copy":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
//exit;
break;
case "paste":
//echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
//exit;
break;
case "new":
//echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
//exit;
break;
}
// At the beginning of the recursive process it avoids second call of the notify function with the same parameter
if ($a_node_id==$_GET["ref_id"])
{
$parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
$parent_type = $parent_obj->getType();
if($parent_type == $this->getType())
{
$a_node_id = (int) $tree->getParentId($a_node_id);
}
}
parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
}
Here is the call graph for this function:| ilObjTest::pcArrayShuffle | ( | $ | array | ) |
Shuffles the values of a given array.
Shuffles the values of a given array
| array | $array An array which should be shuffled public |
Definition at line 3724 of file class.ilObjTest.php.
{
mt_srand((double)microtime()*1000000);
$i = count($array);
if ($i > 0)
{
while(--$i)
{
$j = mt_rand(0, $i);
if ($i != $j)
{
// swap elements
$tmp = $array[$j];
$array[$j] = $array[$i];
$array[$i] = $tmp;
}
}
}
return $array;
}
| ilObjTest::prepareTextareaOutput | ( | $ | txt_output, | |
| $ | prepare_for_latex_output = FALSE | |||
| ) |
Prepares a string for a text area output in tests.
| string | $txt_output String which should be prepared for output public |
Definition at line 8694 of file class.ilObjTest.php.
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
}
| & ilObjTest::processCSVRow | ( | $ | row, | |
| $ | quoteAll = FALSE, |
|||
| $ | separator = ";" | |||
| ) |
Convertes an array for CSV usage.
Processes an array as a CSV row and converts the array values to correct CSV values. The "converted" array is returned
| array | $row The array containing the values for a CSV row | |
| string | $quoteAll Indicates to quote every value (=TRUE) or only values containing quotes and separators (=FALSE, default) | |
| string | $separator The value separator in the CSV row (used for quoting) (; = default) |
Definition at line 7421 of file class.ilObjTest.php.
References $separator.
{
$resultarray = array();
foreach ($row as $rowindex => $entry)
{
$surround = FALSE;
if ($quoteAll)
{
$surround = TRUE;
}
if (strpos($entry, "\"") !== FALSE)
{
$entry = str_replace("\"", "\"\"", $entry);
$surround = TRUE;
}
if (strpos($entry, $separator) !== FALSE)
{
$surround = TRUE;
}
// replace all CR LF with LF (for Excel for Windows compatibility
$entry = str_replace(chr(13).chr(10), chr(10), $entry);
if ($surround)
{
$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
}
else
{
$resultarray[$rowindex] = utf8_decode($entry);
}
}
return $resultarray;
}
| ilObjTest::processPrintoutput2FO | ( | $ | print_output | ) |
Convert a print output to XSL-FO.
Convert a print output to XSL-FO
| string | $print_output The print output |
Definition at line 9180 of file class.ilObjTest.php.
References xslt_create(), xslt_error(), xslt_free(), and xslt_process().
{
$print_output = str_replace(" ", " ", $print_output);
$print_output = str_replace("⊗", "X", $print_output);
$xsl = file_get_contents("./Modules/Test/xml/question2fo.xsl");
$args = array( '/_xml' => $print_output, '/_xsl' => $xsl );
$xh = xslt_create();
$params = array();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
xslt_error($xh);
xslt_free($xh);
return $output;
}
Here is the call graph for this function:| ilObjTest::QTIMaterialToString | ( | $ | a_material | ) |
Reads an QTI material tag an creates a text string.
| string | $a_material QTI material tag |
Definition at line 8626 of file class.ilObjTest.php.
References $_SESSION, and $ilLog.
Referenced by fromXML().
{
$result = "";
for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
{
$material = $a_material->getMaterial($i);
if (strcmp($material["type"], "mattext") == 0)
{
$result .= $material["material"]->getContent();
}
if (strcmp($material["type"], "matimage") == 0)
{
$matimage = $material["material"];
if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
{
// import an mediaobject which was inserted using tiny mce
if (!is_array($_SESSION["import_mob_xhtml"])) $_SESSION["import_mob_xhtml"] = array();
array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
}
}
}
global $ilLog;
$ilLog->write(print_r($_SESSION["import_mob_xhtml"], true));
return $result;
}
Here is the caller graph for this function:| ilObjTest::questionMoveDown | ( | $ | question_id | ) |
Moves a question down in order.
Moves a question down in order
| integer | $question_id The database id of the question to be moved down public |
Definition at line 3235 of file class.ilObjTest.php.
References $data, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), loadQuestions(), and logAction().
{
global $ilDB;
// Move a question down in sequence
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($question_id)
);
$result = $ilDB->query($query);
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($data->sequence + 1)
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
// OK, it's not the last question, so move it down
$data_next = $result->fetchRow(DB_FETCHMODE_OBJECT);
// change next dataset
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$ilDB->quote($data->sequence),
$ilDB->quote($data_next->test_question_id)
);
$result = $ilDB->query($query);
// move actual dataset down
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$ilDB->quote($data->sequence + 1),
$ilDB->quote($data->test_question_id)
);
$result = $ilDB->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($data->sequence) . " => " . ($data->sequence+1), $question_id);
}
}
$this->loadQuestions();
}
Here is the call graph for this function:| ilObjTest::questionMoveUp | ( | $ | question_id | ) |
Moves a question up in order.
Moves a question up in order
| integer | $question_id The database id of the question to be moved up public |
Definition at line 3186 of file class.ilObjTest.php.
References $data, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), loadQuestions(), and logAction().
{
global $ilDB;
// Move a question up in sequence
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($question_id)
);
$result = $ilDB->query($query);
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
if ($data->sequence > 1) {
// OK, it's not the top question, so move it up
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($data->sequence - 1)
);
$result = $ilDB->query($query);
$data_previous = $result->fetchRow(DB_FETCHMODE_OBJECT);
// change previous dataset
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$ilDB->quote($data->sequence),
$ilDB->quote($data_previous->test_question_id)
);
$result = $ilDB->query($query);
// move actual dataset up
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$ilDB->quote($data->sequence - 1),
$ilDB->quote($data->test_question_id)
);
$result = $ilDB->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($data->sequence) . " => " . ($data->sequence-1), $question_id);
}
}
$this->loadQuestions();
}
Here is the call graph for this function:| ilObjTest::randomSelectQuestions | ( | $ | nr_of_questions, | |
| $ | questionpool, | |||
| $ | use_obj_id = 0, |
|||
| $ | qpls = "", |
|||
| $ | pass = NULL | |||
| ) |
Returns a random selection of questions.
Returns a random selection of questions
| integer | $nr_of_questions Number of questions to return | |
| integer | $questionpool ID of questionpool to choose the questions from (0 = all available questionpools) | |
| boolean | $user_obj_id Use the object id instead of the reference id when set to true | |
| array | $qpls An array of questionpool id's if the random questions should only be chose from the contained questionpools |
Definition at line 5125 of file class.ilObjTest.php.
References ilObjQuestionPool::_getAvailableQuestionpools().
Referenced by generateRandomQuestions().
{
global $rbacsystem;
global $ilDB;
// get the questionpool id if a questionpool ref id was entered
if ($questionpool != 0)
{
// retrieve object id
if (!$use_obj_id)
{
$query = sprintf("SELECT obj_id FROM object_reference WHERE ref_id = %s",
$ilDB->quote("$questionpool")
);
$result = $ilDB->query($query);
$row = $result->fetchRow(DB_FETCHMODE_ARRAY);
$questionpool = $row[0];
}
}
// get all existing questions in the test
$query = sprintf("SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND tst_test_question.test_fi = %s",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
$original_ids = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if (strcmp($row[0], "") != 0)
{
array_push($original_ids, $row[0]);
}
}
$original_clause = "";
if (count($original_ids))
{
$original_clause = " AND ISNULL(qpl_questions.original_id) AND qpl_questions.question_id NOT IN ('" . join($original_ids, "','") . "')";
}
// get a list of questionpools which are not allowed for the test (only for random selection of questions in test questions editor)
if (($questionpool == 0) && (!is_array($qpls)))
{
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
$available_pools = array_keys(ilObjQuestionPool::_getAvailableQuestionpools($use_object_id = TRUE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE));
$available = "";
$constraint_qpls = "";
if (count($available_pools))
{
$available = " AND qpl_questions.obj_fi IN ('" . join($available_pools, "','") . "')";
}
else
{
return array();
}
}
$result_array = array();
if ($questionpool == 0)
{
if (is_array($qpls))
{
if (count($qpls) > 0)
{
$qplidx = array();
foreach ($qpls as $idx => $arr)
{
array_push($qplidx, $arr["qpl"]);
}
$constraint_qpls = " AND qpl_questions.obj_fi IN ('" . join($qplidx, "','") . "')";
}
}
$query = "SELECT COUNT(question_id) FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause";
}
else
{
$query = sprintf("SELECT COUNT(question_id) FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s$original_clause",
$ilDB->quote("$questionpool")
);
}
$result = $ilDB->query($query);
$row = $result->fetchRow(DB_FETCHMODE_ARRAY);
if (($row[0]) <= $nr_of_questions)
{
// take all available questions
if ($questionpool == 0)
{
$query = "SELECT question_id FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause";
}
else
{
$query = sprintf("SELECT question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s AND qpl_questions.complete = '1'$original_clause",
$ilDB->quote("$questionpool")
);
}
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if ((!in_array($row[0], $this->questions)) && (strcmp($row[0], "") != 0))
{
$result_array[$row[0]] = $row[0];
}
}
}
else
{
// select a random number out of the maximum number of questions
mt_srand((double)microtime()*1000000);
$random_number = mt_rand(0, $row[0] - 1);
$securitycounter = 500;
while ((count($result_array) < $nr_of_questions) && ($securitycounter > 0))
{
if ($questionpool == 0)
{
$query = "SELECT question_id FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause LIMIT $random_number, 1";
}
else
{
$query = sprintf("SELECT question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s AND qpl_questions.complete = '1'$original_clause LIMIT $random_number, 1",
$ilDB->quote("$questionpool")
);
}
$result = $ilDB->query($query);
$result_row = $result->fetchRow(DB_FETCHMODE_ARRAY);
if ((!in_array($result_row[0], $this->questions)) && (strcmp($result_row[0], "") != 0))
{
$result_array[$result_row[0]] = $result_row[0];
}
$random_number = mt_rand(0, $row[0] - 1);
$securitycounter--;
}
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::read | ( | $ | a_force_db = false |
) |
read object data from db into object
| boolean | public |
Reimplemented from ilObject.
Definition at line 541 of file class.ilObjTest.php.
References loadFromDb().
{
parent::read($a_force_db);
$this->loadFromDb();
}
Here is the call graph for this function:| ilObjTest::removeAllTestEditings | ( | $ | question_id = "" |
) |
Removes all references to the question in executed tests in case the question has been changed.
Removes all references to the question in executed tests in case the question has been changed. If a question was changed it cannot be guaranteed that the content and the meaning of the question is the same as before. So we have to delete all already started or completed tests using that question. Therefore we have to delete all references to that question in tst_solutions and the tst_active entries which were created for the user and test in the tst_solutions entry.
public
Definition at line 2979 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), isRandomTest(), and logAction().
Referenced by deleteTest(), removeNonRandomTestData(), removeQuestion(), and removeRandomTestData().
{
global $ilDB;
// remove the question from tst_solutions
if ($question_id)
{
$query = sprintf("DELETE FROM tst_solutions USING tst_solutions, tst_active where tst_solutions.active_fi = tst_active.active_id AND tst_active.test_fi = %s AND tst_solutions.question_fi = %s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($question_id)
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings USING tst_active_qst_sol_settings, tst_active where tst_active_qst_sol_settings.active_fi = tst_active.active_id AND tst_active.test_fi = %s AND tst_active_qst_sol_settings.question_fi = %s",
$ilDB->quote($this->getTestId()),
$ilDB->quote($question_id)
);
$query3 = sprintf("DELETE FROM tst_test_result USING tst_test_result, tst_active WHERE tst_active.test_fi = %s AND tst_test_result.question_fi = %s AND tst_active.active_id = tst_test_result.active_fi",
$ilDB->quote($this->getTestId()),
$ilDB->quote($question_id)
);
$query4 = sprintf("DELETE FROM tst_test_pass_result USING tst_test_pass_result, tst_active WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_test_pass_result.active_fi",
$ilDB->quote($this->getTestId())
);
}
else
{
$query = sprintf("DELETE FROM tst_solutions USING tst_solutions, tst_active where tst_solutions.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
$ilDB->quote($this->getTestId())
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings USING tst_active_qst_sol_settings, tst_active where tst_active_qst_sol_settings.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
$ilDB->quote($this->getTestId())
);
$query3 = sprintf("DELETE FROM tst_test_result USING tst_test_result, tst_active WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_test_result.active_fi",
$ilDB->quote($this->getTestId())
);
$query4 = sprintf("DELETE FROM tst_test_pass_result USING tst_test_pass_result, tst_active WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_test_pass_result.active_fi",
$ilDB->quote($this->getTestId())
);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_user_data_removed", ilObjAssessmentFolder::_getLogLanguage()));
}
}
$query5 = sprintf("DELETE FROM tst_sequence USING tst_sequence, tst_active WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_sequence.active_fi",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$result = $ilDB->query($query2);
$result = $ilDB->query($query3);
$result = $ilDB->query($query4);
$result = $ilDB->query($query5);
if ($this->isRandomTest())
{
$query = sprintf("DELETE FROM tst_test_random_question USING tst_test_random_question, tst_active WHERE tst_active.test_fi = %s AND tst_test_random_question.active_fi = tst_active.active_id",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
}
// remove test_active entries, because test has changed
$query = sprintf("DELETE FROM tst_active WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
// remove saved user passwords
$query = sprintf("DELETE FROM usr_pref WHERE keyword = %s",
$ilDB->quote("tst_password_".$this->getTestId())
);
$result = $ilDB->query($query);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::removeNonRandomTestData | ( | ) |
Removes all test data of a non random test when a test was set to random test.
Removes all test data of a non random test when a test was set to random test
private
Definition at line 6824 of file class.ilObjTest.php.
References removeAllTestEditings(), and saveCompleteStatus().
{
global $ilDB;
// delete eventually set questions of a previous non-random test
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$this->questions = array();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::removeQuestion | ( | $ | question_id | ) |
Removes a question from the test object.
Removes a question from the test object
| integer | $question_id The database id of the question to be removed public |
Definition at line 2954 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), _instanciateQuestion(), loadQuestions(), logAction(), removeAllTestEditings(), and saveQuestionsToDb().
Referenced by deleteTest().
{
$question =& ilObjTest::_instanciateQuestion($question_id);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_removed", ilObjAssessmentFolder::_getLogLanguage()), $question_id);
}
$question->delete($question_id);
$this->removeAllTestEditings($question_id);
$this->loadQuestions();
$this->saveQuestionsToDb();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::removeRandomTestData | ( | ) |
Removes all test data of a random test when a test was set to non random test.
Removes all test data of a random test when a test was set to non random test
private
Definition at line 6845 of file class.ilObjTest.php.
References removeAllTestEditings(), and saveCompleteStatus().
{
global $ilDB;
// delete eventually set random question pools of a previous random test
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$this->questions = array();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::removeSelectedTestResults | ( | $ | active_ids | ) |
Definition at line 3051 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), _getUserIdFromActiveId(), getTestId(), isRandomTest(), logAction(), and userLookupFullName().
{
global $ilDB;
// remove the question from tst_solutions
foreach ($active_ids as $active_id)
{
$query = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query3 = sprintf("DELETE FROM tst_test_result WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query4 = sprintf("DELETE FROM tst_test_pass_result WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$result = $ilDB->query($query2);
$result = $ilDB->query($query3);
$result = $ilDB->query($query4);
if ($this->isRandomTest())
{
$query = sprintf("DELETE FROM tst_test_random_question WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
}
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_selected_user_data_removed", ilObjAssessmentFolder::_getLogLanguage()), $this->userLookupFullName($this->_getUserIdFromActiveId($active_id))));
}
}
// remove test_active entries of selected users
foreach ($active_ids as $active_id)
{
$usr_id = $this->_getUserIdFromActiveId($active_id);
$query = sprintf("DELETE FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$query = sprintf("DELETE FROM tst_sequence WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
// remove saved user password
if ($usr_id > 0)
{
$query = sprintf("DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s",
$ilDB->quote($usr_id),
$ilDB->quote("tst_password_".$this->getTestId())
);
$result = $ilDB->query($query);
}
}
}
Here is the call graph for this function:| ilObjTest::removeTestResultsForUser | ( | $ | user_id | ) |
Definition at line 3117 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), _getUserIdFromActiveId(), getActiveIdOfUser(), getTestId(), isRandomTest(), logAction(), and userLookupFullName().
{
global $ilDB;
$active_id = $this->getActiveIdOfUser($user_id);
// remove the question from tst_solutions
$query = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query3 = sprintf("DELETE FROM tst_test_result WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$query4 = sprintf("DELETE FROM tst_test_pass_result WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$result = $ilDB->query($query2);
$result = $ilDB->query($query3);
$result = $ilDB->query($query4);
if ($this->isRandomTest())
{
$query = sprintf("DELETE FROM tst_test_random_question WHERE active_fi = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
}
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_selected_user_data_removed", ilObjAssessmentFolder::_getLogLanguage()), $this->userLookupFullName($this->_getUserIdFromActiveId($active_id))));
}
$query = sprintf("DELETE FROM tst_sequence WHERE active_fi = %s",
$ilDB->quote($active_id)
);
$result = $ilDB->query($query);
// remove test_active entry
$query = sprintf("DELETE FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
// remove saved user password
if ($user_id > 0)
{
$query = sprintf("DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s",
$ilDB->quote($user_id),
$ilDB->quote("tst_password_".$this->getTestId())
);
$result = $ilDB->query($query);
}
}
Here is the call graph for this function:| ilObjTest::saveAuthorToMetadata | ( | $ | a_author = "" |
) |
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists.
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
| string | $a_author A string containing the name of the test author private |
Definition at line 6417 of file class.ilObjTest.php.
References ilObject::getId(), and ilObject::getType().
Referenced by createMetaData(), and loadFromDb().
{
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_life =& $md->getLifecycle();
if (!$md_life)
{
if (strlen($a_author) == 0)
{
global $ilUser;
$a_author = $ilUser->getFullname();
}
$md_life =& $md->addLifecycle();
$md_life->save();
$con =& $md_life->addContribute();
$con->setRole("Author");
$con->save();
$ent =& $con->addEntity();
$ent->setEntity($a_author);
$ent->save();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveCertificateVisibility | ( | $ | a_value | ) |
Saves the visibility settings of the certificate.
Saves the visibility settings of the certificate
| integer | $a_value The value for the visibility settings (0 = always, 1 = only passed, 2 = never) private |
Definition at line 8708 of file class.ilObjTest.php.
References getTestId().
{
global $ilDB;
$query = sprintf("UPDATE tst_tests SET certificate_visibility = %s WHERE test_id = %s",
$ilDB->quote($a_value),
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
}
Here is the call graph for this function:| ilObjTest::saveCompleteStatus | ( | ) |
Checks if the test is complete and saves the status in the database.
Checks if the test is complete and saves the status in the database
public
Definition at line 1076 of file class.ilObjTest.php.
References isComplete().
Referenced by insertQuestion(), removeNonRandomTestData(), and removeRandomTestData().
{
global $ilDB;
$complete = 0;
if ($this->isComplete())
{
$complete = 1;
}
if ($this->test_id > 0)
{
$query = sprintf("UPDATE tst_tests SET complete = %s WHERE test_id = %s",
$ilDB->quote("$complete"),
$ilDB->quote($this->test_id)
);
$result = $ilDB->query($query);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveECTSStatus | ( | $ | ects_output = 0, |
|
| $ | fx_support = "", |
|||
| $ | ects_a = 90, |
|||
| $ | ects_b = 65, |
|||
| $ | ects_c = 35, |
|||
| $ | ects_d = 10, |
|||
| $ | ects_e = 0 | |||
| ) |
Saves the ECTS status (output of ECTS grades in a test) to the database.
Saves the ECTS status (output of ECTS grades in a test) to the database
public
Definition at line 1040 of file class.ilObjTest.php.
References $ects_output, and getTestId().
{
global $ilDB;
if ($this->test_id > 0) {
$fx_support = preg_replace("/,/", ".", $fx_support);
if (preg_match("/\d+/", $fx_support))
{
$fx_support = $fx_support;
}
else
{
$fx_support = "NULL";
}
$query = sprintf("UPDATE tst_tests SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s WHERE test_id = %s",
$ilDB->quote("$ects_output"),
$ilDB->quote($ects_a . ""),
$ilDB->quote($ects_b . ""),
$ilDB->quote($ects_c . ""),
$ilDB->quote($ects_d . ""),
$ilDB->quote($ects_e . ""),
$fx_support,
$this->getTestId()
);
$result = $ilDB->query($query);
$this->ects_output = $ects_output;
$this->ects_fx = $fx_support;
}
}
Here is the call graph for this function:| ilObjTest::saveManualFeedback | ( | $ | active_id, | |
| $ | question_id, | |||
| $ | pass, | |||
| $ | feedback | |||
| ) |
Saves the manual feedback for a question in a test.
Saves the manual feedback for a question in a test
| integer | $active_id Active ID of the user | |
| integer | $question_id Question ID | |
| integer | $pass Pass number | |
| string | $feedback The feedback text |
Definition at line 9257 of file class.ilObjTest.php.
References ilRTE::_replaceMediaObjectImageSrc().
{
global $ilDB;
$query = sprintf("DELETE FROM tst_manual_feedback WHERE active_fi = %s AND question_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if (strlen($feedback))
{
$query = sprintf("INSERT INTO tst_manual_feedback (active_fi, question_fi, pass, feedback) VALUES (%s, %s, %s, %s)",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . ""),
$ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($feedback, 0) . "")
);
$result = $ilDB->query($query);
}
if ($result == DB_OK)
{
return TRUE;
}
else
{
return FALSE;
}
}
Here is the call graph for this function:| ilObjTest::saveQuestionsToDb | ( | ) |
Saves the test questions to the database.
Saves the test questions to the database
public
Definition at line 1406 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), and logAction().
Referenced by moveQuestions(), removeQuestion(), and saveToDb().
{
global $ilDB;
$oldquestions = array();
include_once "./classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
if ($result->numRows() > 0)
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($oldquestions, $row["question_fi"]);
}
}
}
// delete existing category relations
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
// create new category relations
foreach ($this->questions as $key => $value) {
$query = sprintf("INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($value . ""),
$ilDB->quote($key . "")
);
$result = $ilDB->query($query);
}
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
$newquestions = array();
if ($result->numRows() > 0)
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($newquestions, $row["question_fi"]);
}
}
foreach ($oldquestions as $index => $question_id)
{
if (strcmp($newquestions[$index], $question_id) != 0)
{
$pos = array_search($question_id, $newquestions);
if ($pos === FALSE)
{
$this->logAction($this->lng->txtlng("assessment", "log_question_removed", ilObjAssessmentFolder::_getLogLanguage()), $question_id);
}
else
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($index+1) . " => " . ($pos+1), $question_id);
}
}
}
foreach ($newquestions as $index => $question_id)
{
if (array_search($question_id, $oldquestions) === FALSE)
{
$this->logAction($this->lng->txtlng("assessment", "log_question_added", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($index+1), $question_id);
}
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveRandomQuestion | ( | $ | active_id, | |
| $ | question_id, | |||
| $ | pass = NULL, |
|||
| $ | maxcount | |||
| ) |
Saves a random question to the database.
Saves a random question to the database
public
Definition at line 1489 of file class.ilObjTest.php.
References duplicateQuestionForTest(), and getRandomQuestionDuplicate().
Referenced by generateRandomQuestions().
{
global $ilUser;
global $ilDB;
if (is_null($pass)) $pass = 0;
$query = sprintf("SELECT test_random_question_id FROM tst_test_random_question WHERE active_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows() < $maxcount)
{
$duplicate_id = $this->getRandomQuestionDuplicate($question_id, $active_id);
if ($duplicate_id === FALSE)
{
$duplicate_id = $this->duplicateQuestionForTest($question_id);
}
$query = sprintf("INSERT INTO tst_test_random_question (test_random_question_id, active_fi, question_fi, sequence, pass, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL)",
$ilDB->quote($active_id . ""),
$ilDB->quote($duplicate_id . ""),
$ilDB->quote(($result->numRows()+1) . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveRandomQuestionCount | ( | $ | total_questions = "NULL" |
) |
Saves the total amount of a tests random questions to the database.
Saves the total amount of a tests random questions to the database
| integer | $total_questions The amount of random questions public |
Definition at line 1701 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), logAction(), and setRandomQuestionCount().
{
global $ilDB;
if (strcmp($total_questions, "NULL") != 0)
{
$this->setRandomQuestionCount($total_questions);
$total_questions = $ilDB->quote($total_questions);
}
$query = sprintf("UPDATE tst_tests SET random_question_count = %s WHERE test_id = %s",
$total_questions,
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
if (strcmp($total_questions, "NULL") == 0) $total_questions = '0';
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_total_amount_of_questions", ilObjAssessmentFolder::_getLogLanguage()), $total_questions));
}
}
Here is the call graph for this function:| ilObjTest::saveRandomQuestionpools | ( | $ | qpl_array | ) |
Saves the question pools used for a random test.
Saves the question pools used for a random test
| array | $qpl_array An array containing the questionpool id's public |
Definition at line 1732 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), _getQuestionCount(), and logAction().
{
global $ilDB;
include_once ("./classes/class.ilObjAssessmentFolder.php");
// delete existing random questionpools
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$ilDB->quote($this->getTestId())
);
$result = $ilDB->query($query);
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_random_question_pool_deleted", ilObjAssessmentFolder::_getLogLanguage()));
}
// create new random questionpools
foreach ($qpl_array as $key => $value) {
if ($value["qpl"] > -1)
{
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
$count = ilObjQuestionPool::_getQuestionCount($value["qpl"]);
if ($value["count"] > $count)
{
$value["count"] = $count;
}
$query = sprintf("INSERT INTO tst_test_random (test_random_id, test_fi, questionpool_fi, num_of_q, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($value["qpl"] . ""),
$ilDB->quote(sprintf("%d", $value["count"]) . "")
);
$result = $ilDB->query($query);
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction(sprintf($this->lng->txtlng("assessment", "log_random_question_pool_added", ilObjAssessmentFolder::_getLogLanguage()), $value["title"] . " (" . $value["qpl"] . ")", $value["count"]));
}
}
}
}
Here is the call graph for this function:| ilObjTest::saveToDb | ( | $ | properties_only = FALSE |
) |
Saves a ilObjTest object to a database.
Saves a ilObjTest object to a database (experimental)
| object | $db A pear DB object public |
Definition at line 1136 of file class.ilObjTest.php.
References $allowedUsers, $allowedUsersTimeGap, $ects_fx, $ilLog, $random_question_count, $shuffle_questions, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), ilRTE::_replaceMediaObjectImageSrc(), cleanupMediaobjectUsage(), evalTotalPersons(), getAllowedUsers(), getAllowedUsersTimeGap(), getAnonymity(), getAnswerFeedback(), getAnswerFeedbackPoints(), getFixedParticipants(), getInstantFeedbackSolution(), getListOfQuestionsSettings(), getNrOfTries(), getPassScoring(), getPassword(), getResetProcessingTime(), getResultsPresentation(), getScoreCutting(), getShowCancel(), getShowMarker(), getShuffleQuestions(), getTitleOutput(), getUsePreviousAnswers(), isComplete(), isRandomTest(), logAction(), and saveQuestionsToDb().
Referenced by applyDefaults(), createReference(), and fromXML().
{
global $ilDB, $ilLog;
$complete = 0;
if ($this->isComplete())
{
$complete = 1;
}
$ects_fx = "NULL";
if (preg_match("/\d+/", $this->ects_fx))
{
$ects_fx = $this->ects_fx;
}
$random_question_count = "NULL";
if ($this->random_question_count > 0)
{
$random_question_count = $ilDB->quote($this->random_question_count . "");
}
$shuffle_questions = 0;
if ($this->getShuffleQuestions())
{
$shuffle_questions = 1;
}
$allowedUsers = $this->getAllowedUsers();
if ($allowedUsers == 0)
{
$allowedUsers = "NULL";
}
else
{
$allowedUsers = $ilDB->quote($allowedUsers);
}
$allowedUsersTimeGap = $this->getAllowedUsersTimeGap();
if ($allowedUsersTimeGap == 0)
{
$allowedUsersTimeGap = "NULL";
}
else
{
$allowedUsersTimeGap = $ilDB->quote($allowedUsersTimeGap);
}
// cleanup RTE images
$this->cleanupMediaobjectUsage();
include_once ("./classes/class.ilObjAssessmentFolder.php");
if ($this->test_id == -1)
{
// Create new dataset
$now = getdate();
$created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
$query = sprintf("INSERT INTO tst_tests (test_id, obj_fi, author, introduction, sequence_settings, " .
"score_reporting, instant_verification, answer_feedback_points, answer_feedback, anonymity, show_cancel, show_marker, " .
"fixed_participants, nr_of_tries, use_previous_answers, title_output, processing_time, enable_processing_time, reset_processing_time, " .
"reporting_date, starting_time, ending_time, complete, ects_output, ects_a, ects_b, ects_c, ects_d, ects_e, " .
"ects_fx, random_test, random_question_count, count_system, mc_scoring, score_cutting, pass_scoring, " .
"shuffle_questions, results_presentation, show_summary, password, allowedUsers, " .
"allowedUsersTimeGap, certificate_visibility, created, TIMESTAMP) " .
"VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, " .
"%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
$ilDB->quote($this->getId() . ""),
$ilDB->quote($this->getAuthor() . ""),
$ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->introduction, 0)),
$ilDB->quote($this->sequence_settings . ""),
$ilDB->quote($this->score_reporting . ""),
$ilDB->quote($this->getInstantFeedbackSolution() . ""),
$ilDB->quote($this->getAnswerFeedbackPoints() . ""),
$ilDB->quote($this->getAnswerFeedback() . ""),
$ilDB->quote($this->getAnonymity() . ""),
$ilDB->quote($this->getShowCancel() . ""),
$ilDB->quote($this->getShowMarker() . ""),
$ilDB->quote($this->getFixedParticipants() . ""),
$ilDB->quote(sprintf("%d", $this->getNrOfTries()) . ""),
$ilDB->quote(sprintf("%d", $this->getUsePreviousAnswers() . "")),
$ilDB->quote(sprintf("%d", $this->getTitleOutput() . "")),
$ilDB->quote($this->processing_time . ""),
$ilDB->quote("$this->enable_processing_time"),
$ilDB->quote($this->getResetProcessingTime() . ""),
$ilDB->quote($this->reporting_date . ""),
$ilDB->quote($this->starting_time . ""),
$ilDB->quote($this->ending_time . ""),
$ilDB->quote("$complete"),
$ilDB->quote($this->ects_output . ""),
$ilDB->quote($this->ects_grades["A"] . ""),
$ilDB->quote($this->ects_grades["B"] . ""),
$ilDB->quote($this->ects_grades["C"] . ""),
$ilDB->quote($this->ects_grades["D"] . ""),
$ilDB->quote($this->ects_grades["E"] . ""),
$ects_fx,
$ilDB->quote(sprintf("%d", $this->random_test) . ""),
$random_question_count,
$ilDB->quote($this->count_system . ""),
$ilDB->quote($this->mc_scoring . ""),
$ilDB->quote($this->getScoreCutting() . ""),
$ilDB->quote($this->getPassScoring() . ""),
$ilDB->quote($shuffle_questions . ""),
$ilDB->quote($this->getResultsPresentation() . ""),
$ilDB->quote($this->getListOfQuestionsSettings() . ""),
$ilDB->quote($this->getPassword() . ""),
$allowedUsers,
$allowedUsersTimeGap,
$ilDB->quote("0"),
$ilDB->quote($created)
);
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_create_new_test", ilObjAssessmentFolder::_getLogLanguage()));
}
$result = $ilDB->query($query);
if ($result == DB_OK) {
$this->test_id = $ilDB->getLastInsertId();
}
}
else
{
// Modify existing dataset
$oldrow = array();
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$ilDB->quote($this->test_id)
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$oldrow = $result->fetchRow(DB_FETCHMODE_ASSOC);
}
}
$query = sprintf("UPDATE tst_tests SET author = %s, introduction = %s, sequence_settings = %s, score_reporting = %s, instant_verification = %s, answer_feedback_points = %s, answer_feedback = %s, anonymity = %s, show_cancel = %s, show_marker = %s, fixed_participants = %s, nr_of_tries = %s, use_previous_answers = %s, title_output = %s, processing_time = %s, enable_processing_time = %s, reset_processing_time = %s, reporting_date = %s, starting_time = %s, ending_time = %s, ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s, random_test = %s, complete = %s, count_system = %s, mc_scoring = %s, score_cutting = %s, pass_scoring = %s, shuffle_questions = %s, results_presentation = %s, show_summary = %s, password = %s, allowedUsers = %s, allowedUsersTimeGap = %s WHERE test_id = %s",
$ilDB->quote($this->getAuthor() . ""),
$ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->introduction, 0)),
$ilDB->quote($this->sequence_settings . ""),
$ilDB->quote($this->score_reporting . ""),
$ilDB->quote($this->getInstantFeedbackSolution() . ""),
$ilDB->quote($this->getAnswerFeedbackPoints() . ""),
$ilDB->quote($this->getAnswerFeedback() . ""),
$ilDB->quote($this->getAnonymity() . ""),
$ilDB->quote($this->getShowCancel() . ""),
$ilDB->quote($this->getShowMarker() . ""),
$ilDB->quote($this->getFixedParticipants() . ""),
$ilDB->quote(sprintf("%d", $this->getNrOfTries()) . ""),
$ilDB->quote(sprintf("%d", $this->getUsePreviousAnswers() . "")),
$ilDB->quote(sprintf("%d", $this->getTitleOutput() . "")),
$ilDB->quote($this->processing_time . ""),
$ilDB->quote("$this->enable_processing_time"),
$ilDB->quote($this->getResetProcessingTime() . ""),
$ilDB->quote($this->reporting_date . ""),
$ilDB->quote($this->starting_time . ""),
$ilDB->quote($this->ending_time . ""),
$ilDB->quote($this->ects_output . ""),
$ilDB->quote($this->ects_grades["A"] . ""),
$ilDB->quote($this->ects_grades["B"] . ""),
$ilDB->quote($this->ects_grades["C"] . ""),
$ilDB->quote($this->ects_grades["D"] . ""),
$ilDB->quote($this->ects_grades["E"] . ""),
$ects_fx,
$ilDB->quote(sprintf("%d", $this->random_test) . ""),
$ilDB->quote("$complete"),
$ilDB->quote($this->count_system . ""),
$ilDB->quote($this->mc_scoring . ""),
$ilDB->quote($this->getScoreCutting() . ""),
$ilDB->quote($this->getPassScoring() . ""),
$ilDB->quote($shuffle_questions . ""),
$ilDB->quote($this->getResultsPresentation() . ""),
$ilDB->quote($this->getListOfQuestionsSettings() . ""),
$ilDB->quote($this->getPassword() . ""),
$allowedUsers,
$allowedUsersTimeGap,
$ilDB->quote($this->test_id)
);
$result = $ilDB->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$ilDB->quote($this->test_id)
);
$logresult = $ilDB->query($query);
$newrow = array();
if ($logresult->numRows() == 1)
{
$newrow = $logresult->fetchRow(DB_FETCHMODE_ASSOC);
}
$changed_fields = array();
foreach ($oldrow as $key => $value)
{
if (strcmp($oldrow[$key], $newrow[$key]) != 0)
{
array_push($changed_fields, "$key: " . $oldrow[$key] . " => " . $newrow[$key]);
}
}
$changes = join($changed_fields, ", ");
if (count($changed_fields) > 0)
{
$this->logAction($this->lng->txtlng("assessment", "log_modified_test", ilObjAssessmentFolder::_getLogLanguage()) . " [".$changes."]");
}
}
if ($this->evalTotalPersons() > 0)
{
// reset the finished status of participants if the nr of test passes did change
if ($this->getNrOfTries() > 0)
{
// set all unfinished tests with nr of passes >= allowed passes finished
$query = sprintf("SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = 0",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($this->getNrOfTries() . "")
);
$aresult = $ilDB->query($query);
while ($row = $aresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$newquery = sprintf("UPDATE tst_active SET submitted = 1, submittimestamp = NOW() WHERE active_id = %s",
$ilDB->quote($row["active_id"] . "")
);
$newresult = $ilDB->query($newquery);
}
// set all finished tests with nr of passes >= allowed passes not finished
$query = sprintf("SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = 1",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($this->getNrOfTries() . "")
);
$aresult = $ilDB->query($query);
while ($row = $aresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$newquery = sprintf("UPDATE tst_active SET submitted = 0, submittimestamp = NULL WHERE active_id = %s",
$ilDB->quote($row["active_id"] . "")
);
$newresult = $ilDB->query($newquery);
}
}
else
{
// set all finished tests with nr of passes >= allowed passes not finished
$query = sprintf("SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = 1",
$ilDB->quote($this->getTestId() . "")
);
$aresult = $ilDB->query($query);
while ($row = $aresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$newquery = sprintf("UPDATE tst_active SET submitted = 0, submittimestamp = NULL WHERE active_id = %s",
$ilDB->quote($row["active_id"] . "")
);
$newresult = $ilDB->query($newquery);
}
}
}
}
if (!$properties_only)
{
if ($result == DB_OK) {
if (!$this->isRandomTest())
{
$this->saveQuestionsToDb();
}
$this->mark_schema->saveToDb($this->test_id);
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setAccessCodeSession | ( | $ | access_code | ) |
Definition at line 8515 of file class.ilObjTest.php.
References $_SESSION, ilObject::$id, and getTestId().
{
$id = $this->getTestId();
if (!is_array($_SESSION["tst_access_code"]))
{
$_SESSION["tst_access_code"] = array();
}
$_SESSION["tst_access_code"]["$id"] = $access_code;
}
Here is the call graph for this function:| ilObjTest::setActiveTestSubmitted | ( | $ | user_id | ) |
submits active test for user user_id
Definition at line 7359 of file class.ilObjTest.php.
References $ilLog.
{
global $ilDB, $ilLog;
$query = sprintf("UPDATE tst_active SET submitted = 1, submittimestamp = NOW() WHERE test_fi = %s AND user_fi = %s",
$ilDB->quote($this->getTestId() . ""),
$ilDB->quote($user_id . "")
);
$result = $ilDB->query($query);
$this->testSession = NULL;
}
| ilObjTest::setAllowedUsers | ( | $ | a_allowed_users | ) |
Definition at line 8536 of file class.ilObjTest.php.
Referenced by fromXML(), and loadFromDb().
{
$this->allowedUsers = $a_allowed_users;
}
Here is the caller graph for this function:| ilObjTest::setAllowedUsersTimeGap | ( | $ | a_allowed_users_time_gap | ) |
Definition at line 8546 of file class.ilObjTest.php.
Referenced by fromXML(), and loadFromDb().
{
$this->allowedUsersTimeGap = $a_allowed_users_time_gap;
}
Here is the caller graph for this function:| ilObjTest::setAnonymity | ( | $ | a_value = 0 |
) |
Sets the anonymity status of the test.
Sets the anonymity status of the test
| integer | $a_value The value for the anonymity status (0 = personalized, 1 = anonymized) public |
Definition at line 8766 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
switch ($a_value)
{
case 1:
$this->anonymity = 1;
break;
default:
$this->anonymity = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setAnswerFeedback | ( | $ | answer_feedback = 0 |
) |
Sets the answer specific feedback for the test.
Sets the answer specific feedback for the test
| integer | $answer_feedback If 1, answer specific feedback will be shown after answering a question public |
Definition at line 2167 of file class.ilObjTest.php.
References $answer_feedback.
Referenced by applyDefaults(), and fromXML().
{
switch ($answer_feedback)
{
case 1:
$this->answer_feedback = 1;
break;
default:
$this->answer_feedback = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setAnswerFeedbackPoints | ( | $ | answer_feedback_points = 0 |
) |
Sets the answer specific feedback of reached points for the test.
Sets the answer specific feedback of reached points for the test
| integer | $answer_feedback_points If 1, answer specific feedback will show the reached points after answering a question public |
Definition at line 2189 of file class.ilObjTest.php.
References $answer_feedback_points.
Referenced by applyDefaults(), and fromXML().
{
switch ($answer_feedback_points)
{
case 1:
$this->answer_feedback_points = 1;
break;
default:
$this->answer_feedback_points = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setAuthor | ( | $ | author = "" |
) |
Sets the authors name.
Sets the authors name of the ilObjTest object
| string | $author A string containing the name of the test author public |
Definition at line 6401 of file class.ilObjTest.php.
References $author.
Referenced by fromXML().
{
$this->author = $author;
}
Here is the caller graph for this function:| ilObjTest::setCertificateVisibility | ( | $ | a_value | ) |
Sets the visibility settings of the certificate.
Sets the visibility settings of the certificate
| integer | $a_value The value for the visibility settings (0 = always, 1 = only passed, 2 = never) public |
Definition at line 8740 of file class.ilObjTest.php.
Referenced by loadFromDb().
{
$this->certificate_visibility = $a_value;
}
Here is the caller graph for this function:| ilObjTest::setClientIP | ( | $ | user_id, | |
| $ | client_ip | |||
| ) |
Definition at line 7304 of file class.ilObjTest.php.
{
global $ilDB;
$query = sprintf("UPDATE tst_invited_user SET clientip=%s WHERE test_fi=%s and user_fi=%s",
$ilDB->quote($client_ip),
$ilDB->quote($this->test_id),
$ilDB->quote($user_id)
);
$insertresult = $ilDB->query($query);
}
| ilObjTest::setCountSystem | ( | $ | a_count_system = COUNT_PARTIAL_SOLUTIONS |
) |
Sets the count system for the calculation of points.
Sets the count system for the calculation of points
| integer | $a_count_system The count system for the calculation of points. public |
Definition at line 2876 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
$this->count_system = $a_count_system;
}
Here is the caller graph for this function:| ilObjTest::setECTSFX | ( | $ | a_ects_fx | ) |
Sets the ECTS FX grade.
Sets the ECTS FX grade
| string | $a_ects_fx The ECTS FX grade public |
Definition at line 2072 of file class.ilObjTest.php.
Referenced by applyDefaults().
{
$this->ects_fx = $a_ects_fx;
}
Here is the caller graph for this function:| ilObjTest::setECTSGrades | ( | $ | a_ects_grades | ) |
Sets the ECTS grades.
Sets the ECTS grades
| array | $a_ects_grades The ECTS grades public |
Definition at line 2100 of file class.ilObjTest.php.
Referenced by applyDefaults().
{
if (is_array($a_ects_grades))
{
$this->ects_grades = $a_ects_grades;
}
}
Here is the caller graph for this function:| ilObjTest::setECTSOutput | ( | $ | a_ects_output | ) |
Enables/Disables ECTS grades output for this test.
Enables/Disables ECTS grades output for this test
| integer | $a_ects_output 0 if ECTS grades output should be deactivated, 1 otherwise public |
Definition at line 2044 of file class.ilObjTest.php.
Referenced by applyDefaults().
{
$this->ects_output = $a_ects_output ? 1 : 0;
}
Here is the caller graph for this function:| ilObjTest::setEnableProcessingTime | ( | $ | enable = 0 |
) |
Sets the processing time enabled or disabled.
Sets the processing time enabled or disabled
| integer | $enable 0 to disable the processing time, 1 to enable the processing time public |
Definition at line 2809 of file class.ilObjTest.php.
Referenced by applyDefaults().
{
if ($enable) {
$this->enable_processing_time = "1";
} else {
$this->enable_processing_time = "0";
}
}
Here is the caller graph for this function:| ilObjTest::setEndingTime | ( | $ | ending_time = "" |
) |
Sets the ending time for the test.
Sets the ending time in database timestamp format for the test
| string | $ending_time The ending time for the test. Empty string for no ending time. public |
Definition at line 2862 of file class.ilObjTest.php.
References $ending_time.
Referenced by applyDefaults(), and fromXML().
{
$this->ending_time = $ending_time;
}
Here is the caller graph for this function:| ilObjTest::setFixedParticipants | ( | $ | a_value = 1 |
) |
Sets the fixed participants status.
Sets the fixed participants status
| integer | $a_value The value for the fixed participants status (0 = don't allow, 1 = allow) public |
Definition at line 8868 of file class.ilObjTest.php.
Referenced by fromXML().
{
switch ($a_value)
{
case 1:
$this->fixed_participants = 1;
break;
default:
$this->fixed_participants = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setInstantFeedbackSolution | ( | $ | instant_feedback = 0 |
) |
Sets the instant feedback for the solution.
Sets the instant feedback for the solution
| integer | $instant_feedback If 1, the solution will be shown after answering a question public |
Definition at line 2145 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
switch ($instant_feedback)
{
case 1:
$this->instant_verification = 1;
break;
default:
$this->instant_verification = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setIntroduction | ( | $ | introduction = "" |
) |
Sets the introduction.
Sets the introduction text of the ilObjTest object
| string | $introduction An introduction string for the test public |
Definition at line 1946 of file class.ilObjTest.php.
References $introduction.
Referenced by applyDefaults(), and fromXML().
{
$this->introduction = $introduction;
}
Here is the caller graph for this function:| ilObjTest::setListOfQuestions | ( | $ | a_value = TRUE |
) |
Sets if the the list of questions should be presented to the user or not.
Sets if the the list of questions should be presented to the user or not
| boolean | $a_value TRUE if the list of questions should be presented, FALSE otherwise public |
Definition at line 7973 of file class.ilObjTest.php.
{
if ($a_value)
{
$this->show_summary = 1;
}
else
{
$this->show_summary = 0;
}
}
| ilObjTest::setListOfQuestionsDescription | ( | $ | a_value = TRUE |
) |
Sets the show_summary attribute to TRUE if the list of questions should be presented with the question descriptions.
Sets the show_summary attribute to TRUE if the list of questions should be presented with the question descriptions
| boolean | $a_value TRUE if the list of questions should be shown with question descriptions, FALSE otherwise public |
Definition at line 8099 of file class.ilObjTest.php.
References getListOfQuestions(), and getListOfQuestionsDescription().
{
if ($a_value && $this->getListOfQuestions())
{
$this->show_summary = $this->show_summary | 8;
}
if (!$a_value && $this->getListOfQuestions())
{
if ($this->getListOfQuestionsDescription())
{
$this->show_summary = $this->show_summary ^ 8;
}
}
}
Here is the call graph for this function:| ilObjTest::setListOfQuestionsEnd | ( | $ | a_value = TRUE |
) |
Sets if the the list of questions as the end page of the test.
Sets if the the list of questions as the end page of the test
| boolean | $a_value TRUE if the list of questions should be the end page, FALSE otherwise public |
Definition at line 8056 of file class.ilObjTest.php.
References getListOfQuestions(), and getListOfQuestionsEnd().
{
if ($a_value && $this->getListOfQuestions())
{
$this->show_summary = $this->show_summary | 4;
}
if (!$a_value && $this->getListOfQuestions())
{
if ($this->getListOfQuestionsEnd())
{
$this->show_summary = $this->show_summary ^ 4;
}
}
}
Here is the call graph for this function:| ilObjTest::setListOfQuestionsSettings | ( | $ | a_value = 0 |
) |
Sets the settings for the list of questions options in the test properties.
Sets 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
| integer | $a_value 0, 1, 3, 5 or 7 public |
Definition at line 7940 of file class.ilObjTest.php.
Referenced by applyDefaults(), fromXML(), and loadFromDb().
{
$this->show_summary = $a_value;
}
Here is the caller graph for this function:| ilObjTest::setListOfQuestionsStart | ( | $ | a_value = TRUE |
) |
Sets if the the list of questions as the start page of the test.
Sets if the the list of questions as the start page of the test
| boolean | $a_value TRUE if the list of questions should be the start page, FALSE otherwise public |
Definition at line 8013 of file class.ilObjTest.php.
References getListOfQuestions(), and getListOfQuestionsStart().
{
if ($a_value && $this->getListOfQuestions())
{
$this->show_summary = $this->show_summary | 2;
}
if (!$a_value && $this->getListOfQuestions())
{
if ($this->getListOfQuestionsStart())
{
$this->show_summary = $this->show_summary ^ 2;
}
}
}
Here is the call graph for this function:| ilObjTest::setMCScoring | ( | $ | a_mc_scoring = SCORE_ZERO_POINTS_WHEN_UNANSWERED |
) |
Sets the multiple choice scoring.
Sets the multiple choice scoring
| integer | $a_mc_scoring The scoring for multiple choice questions public |
Definition at line 2918 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
$this->mc_scoring = $a_mc_scoring;
}
Here is the caller graph for this function:| ilObjTest::setNrOfTries | ( | $ | nr_of_tries = 0 |
) |
Sets the nr of tries for the test.
Sets the nr of tries for the test
| integer | $nr_of_tries The maximum number of tries for the test. 0 for infinite tries. public |
Definition at line 2735 of file class.ilObjTest.php.
References $nr_of_tries.
Referenced by applyDefaults(), and fromXML().
{
$this->nr_of_tries = $nr_of_tries;
}
Here is the caller graph for this function:| ilObjTest::setPassScoring | ( | $ | a_pass_scoring = SCORE_LAST_PASS |
) |
Sets the pass scoring.
Sets the pass scoring
| integer | $a_pass_scoring The pass scoring type public |
Definition at line 2932 of file class.ilObjTest.php.
Referenced by applyDefaults(), fromXML(), and loadFromDb().
{
switch ($a_pass_scoring)
{
case SCORE_BEST_PASS:
$this->pass_scoring = SCORE_BEST_PASS;
break;
default:
$this->pass_scoring = SCORE_LAST_PASS;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setPassword | ( | $ | a_password = "" |
) |
Sets the password for test access.
Sets the password for test access
| string | $a_password The password for test access public |
Definition at line 2890 of file class.ilObjTest.php.
Referenced by fromXML(), and loadFromDb().
{
$this->password = $a_password;
}
Here is the caller graph for this function:| ilObjTest::setProcessingTime | ( | $ | processing_time = "00:00:00" |
) |
Sets the processing time for the test.
Sets the processing time for the test
| string | $processing_time The maximum processing time for the test given in hh:mm:ss public |
Definition at line 2795 of file class.ilObjTest.php.
References $processing_time.
Referenced by applyDefaults().
:00:00") { $this->processing_time = $processing_time; }
Here is the caller graph for this function:| ilObjTest::setQuestionSetSolved | ( | $ | value, | |
| $ | question_id, | |||
| $ | user_id | |||
| ) |
sets question solved state to value for given user_id
Definition at line 7341 of file class.ilObjTest.php.
References getActiveIdOfUser().
{
global $ilDB;
$active_id = $this->getActiveIdOfUser($user_id);
$query = sprintf("REPLACE INTO tst_active_qst_sol_settings SET solved=%s, question_fi=%s, active_fi = %s",
$ilDB->quote($value),
$ilDB->quote($question_id),
$ilDB->quote($active_id)
);
$ilDB->query($query);
}
Here is the call graph for this function:| ilObjTest::setRandomQuestionCount | ( | $ | a_random_question_count = "" |
) |
Sets the random question count.
Sets the random question count
| integer | $a_random_question_count The random question count public |
Definition at line 2225 of file class.ilObjTest.php.
Referenced by applyDefaults(), fromXML(), and saveRandomQuestionCount().
{
$this->random_question_count = $a_random_question_count;
}
Here is the caller graph for this function:| ilObjTest::setRandomTest | ( | $ | a_random_test = 0 |
) |
Sets the random test indicator.
Sets the random test indicator
| integer | $a_random_test The random test indicator (0 = no random test, 1 = random test) public |
Definition at line 2211 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
$this->random_test = $a_random_test;
}
Here is the caller graph for this function:| ilObjTest::setReportingDate | ( | $ | reporting_date | ) |
Sets the reporting date.
Sets the reporting date of the ilObjTest object
| timestamp | $reporting_date The date and time the score reporting is available public |
Definition at line 2239 of file class.ilObjTest.php.
References $reporting_date.
Referenced by applyDefaults(), and fromXML().
{
if (!$reporting_date)
{
$this->reporting_date = "";
$this->ects_output = 0;
}
else
{
$this->reporting_date = $reporting_date;
}
}
Here is the caller graph for this function:| ilObjTest::setResetProcessingTime | ( | $ | reset = 0 |
) |
Sets wheather the processing time should be reset or not.
Sets wheather the processing time should be reset or not
| integer | $reset 1 to reset the processing time, 0 otherwise public |
Definition at line 2827 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
if ($reset)
{
$this->reset_processing_time = 1;
}
else
{
$this->reset_processing_time = 0;
}
}
Here is the caller graph for this function:| ilObjTest::setResultsPresentation | ( | $ | a_results_presentation = 3 |
) |
Sets the combined results presentation value.
Sets the combined results presentation value
| integer | $a_results_presentation The combined results presentation value public |
Definition at line 8255 of file class.ilObjTest.php.
Referenced by applyDefaults(), fromXML(), and loadFromDb().
{
$this->results_presentation = $a_results_presentation;
}
Here is the caller graph for this function:| ilObjTest::setScoreCutting | ( | $ | a_score_cutting = SCORE_CUT_QUESTION |
) |
Sets the type of score cutting.
Sets the type of score cutting
| integer | $a_score_cutting The type of score cutting. 0 for cut questions, 1 for cut tests public |
Definition at line 2904 of file class.ilObjTest.php.
Referenced by fromXML(), and loadFromDb().
{
$this->score_cutting = $a_score_cutting;
}
Here is the caller graph for this function:| ilObjTest::setScoreReporting | ( | $ | score_reporting = 0 |
) |
Sets the score reporting.
Sets the score reporting of the ilObjTest object
| integer | $score_reporting The score reporting public |
Definition at line 2131 of file class.ilObjTest.php.
References $score_reporting.
Referenced by applyDefaults(), and fromXML().
{
$this->score_reporting = $score_reporting;
}
Here is the caller graph for this function:| ilObjTest::setSequenceSettings | ( | $ | sequence_settings = 0 |
) |
Sets the sequence settings.
Sets the sequence settings of the ilObjTest object
| integer | $sequence_settings The sequence settings public |
Definition at line 2117 of file class.ilObjTest.php.
References $sequence_settings.
Referenced by applyDefaults(), and fromXML().
{
$this->sequence_settings = $sequence_settings;
}
Here is the caller graph for this function:| ilObjTest::setShowCancel | ( | $ | a_value = 1 |
) |
Sets the cancel test button status.
Sets the cancel test button status
| integer | $a_value The value for the cancel test status (0 = don't show, 1 = show) public |
Definition at line 8800 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
switch ($a_value)
{
case 1:
$this->show_cancel = 1;
break;
default:
$this->show_cancel = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setShowMarker | ( | $ | a_value = 1 |
) |
Sets the marker button status.
Sets the marker button status
| integer | $a_value The value for the marker status (0 = don't show, 1 = show) public |
Definition at line 8834 of file class.ilObjTest.php.
Referenced by applyDefaults(), and fromXML().
{
switch ($a_value)
{
case 1:
$this->show_marker = 1;
break;
default:
$this->show_marker = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setShowPassDetails | ( | $ | a_details = 1 |
) |
Sets if the pass details should be shown when a test is not finished.
Sets if the pass details should be shown when a test is not finished
| boolean | $a_details TRUE if the pass details should be shown, FALSE otherwise public |
Definition at line 8268 of file class.ilObjTest.php.
References getShowPassDetails().
Referenced by ilObjTest().
{
if ($a_details)
{
$this->results_presentation = $this->results_presentation | 1;
}
else
{
if ($this->getShowPassDetails())
{
$this->results_presentation = $this->results_presentation ^ 1;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShowSolutionAnswersOnly | ( | $ | a_full = TRUE |
) |
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution output.
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution output
| boolean | $a_full TRUE if the full solution should be shown in the solution output, FALSE otherwise public |
Definition at line 8373 of file class.ilObjTest.php.
References getShowSolutionAnswersOnly().
Referenced by ilObjTest().
{
if ($a_full)
{
$this->results_presentation = $this->results_presentation | 16;
}
else
{
if ($this->getShowSolutionAnswersOnly())
{
$this->results_presentation = $this->results_presentation ^ 16;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShowSolutionDetails | ( | $ | a_details = 1 |
) |
Sets if the the solution details should be presented to the user or not.
Sets if the the solution details should be presented to the user or not
| integer | $a_details 1 if the solution details should be presented, 0 otherwise public |
Definition at line 8291 of file class.ilObjTest.php.
References getShowSolutionDetails().
Referenced by fromXML(), and ilObjTest().
{
if ($a_details)
{
$this->results_presentation = $this->results_presentation | 2;
}
else
{
if ($this->getShowSolutionDetails())
{
$this->results_presentation = $this->results_presentation ^ 2;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShowSolutionFeedback | ( | $ | a_feedback = TRUE |
) |
Sets if the the feedback should be presented to the user in the solution or not.
Sets if the the feedback should be presented to the user in the solution or not
| boolean | $a_feedback TRUE if the feedback should be presented in the solution, FALSE otherwise public |
Definition at line 8350 of file class.ilObjTest.php.
References getShowSolutionFeedback().
Referenced by fromXML().
{
if ($a_feedback)
{
$this->results_presentation = $this->results_presentation | 8;
}
else
{
if ($this->getShowSolutionFeedback())
{
$this->results_presentation = $this->results_presentation ^ 8;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShowSolutionPrintview | ( | $ | a_printview = 1 |
) |
Sets if the the solution printview should be presented to the user or not.
Sets if the the solution printview should be presented to the user or not
| boolean | $a_details TRUE if the solution printview should be presented, FALSE otherwise public |
Definition at line 8327 of file class.ilObjTest.php.
References getShowSolutionPrintview().
Referenced by fromXML().
{
if ($a_printview)
{
$this->results_presentation = $this->results_presentation | 4;
}
else
{
if ($this->getShowSolutionPrintview())
{
$this->results_presentation = $this->results_presentation ^ 4;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShowSolutionSignature | ( | $ | a_signature = TRUE |
) |
Set to TRUE, if the signature field should be shown in the solution.
Set to TRUE, if the signature field should be shown in the solution
| boolean | $a_signature TRUE if the signature field should be shown, FALSE otherwise public |
Definition at line 8396 of file class.ilObjTest.php.
References getShowSolutionSignature().
Referenced by ilObjTest().
{
if ($a_signature)
{
$this->results_presentation = $this->results_presentation | 32;
}
else
{
if ($this->getShowSolutionSignature())
{
$this->results_presentation = $this->results_presentation ^ 32;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setShuffleQuestions | ( | $ | a_shuffle | ) |
Sets the status of the shuffle_questions variable.
Sets the status of the shuffle_questions variable
| boolean | $a_shuffle FALSE if the test questions are not shuffled, TRUE if the test questions are shuffled public |
Definition at line 7895 of file class.ilObjTest.php.
Referenced by fromXML(), and loadFromDb().
{
if ($a_shuffle)
{
$this->shuffle_questions = TRUE;
}
else
{
$this->shuffle_questions = FALSE;
}
}
Here is the caller graph for this function:| ilObjTest::setStartingTime | ( | $ | starting_time = "" |
) |
Sets the starting time for the test.
Sets the starting time in database timestamp format for the test
| string | $starting_time The starting time for the test. Empty string for no starting time. public |
Definition at line 2848 of file class.ilObjTest.php.
References $starting_time.
Referenced by applyDefaults(), and fromXML().
{
$this->starting_time = $starting_time;
}
Here is the caller graph for this function:| & ilObjTest::setTestSession | ( | $ | active_id = "" |
) |
Sets the test session data for the active user.
| integer | $active_id The active id of the active user |
Definition at line 9330 of file class.ilObjTest.php.
References $_SESSION, $testSession, and getTestId().
Referenced by getTestSession().
{
if (is_object($this->testSession) && ($this->testSession->getActiveId() > 0)) return $this->testSession;
global $ilUser;
include_once "./Modules/Test/classes/class.ilTestSession.php";
$testSession = FALSE;
if ($active_id > 0)
{
$testSession = new ilTestSession($active_id);
}
else
{
$testSession = new ilTestSession();
$testSession->loadTestSession($this->getTestId(), $ilUser->getId(), $_SESSION["tst_access_code"][$this->getTestId()]);
}
$this->testSession =& $testSession;
return $this->testSession;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setTitleOutput | ( | $ | title_output = 0 |
) |
Sets the status of the title output.
Sets the status of the title output
| integer | $title_output 0 for full title, 1 for title without points, 2 for no title public |
Definition at line 2770 of file class.ilObjTest.php.
References $title_output.
Referenced by applyDefaults(), fromXML(), and loadFromDb().
{
switch ($title_output)
{
case 1:
$this->title_output = 1;
break;
case 2:
$this->title_output = 2;
break;
default:
$this->title_output = 0;
break;
}
}
Here is the caller graph for this function:| ilObjTest::setUsePreviousAnswers | ( | $ | use_previous_answers = 1 |
) |
Sets the status of the visibility of previous learner answers.
Sets the status of the visibility of previous learner answers
| integer | $use_previous_answers 1 if the previous answers should be shown public |
Definition at line 2749 of file class.ilObjTest.php.
References $use_previous_answers.
Referenced by applyDefaults(), fromXML(), and loadFromDb().
{
if ($use_previous_answers)
{
$this->use_previous_answers = 1;
}
else
{
$this->use_previous_answers = 0;
}
}
Here is the caller graph for this function:| ilObjTest::startingTimeReached | ( | ) |
Returns true if the starting time of a test is reached.
Returns true if the starting time of a test is reached A starting time is not available for self assessment tests
Definition at line 5399 of file class.ilObjTest.php.
References getStartingTime().
Referenced by isExecutable().
{
if ($this->getStartingTime())
{
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartingTime(), $matches))
{
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
// starting time not reached
return false;
}
}
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::startWorkingTime | ( | $ | active_id, | |
| $ | pass | |||
| ) |
Write the initial entry for the tests working time to the database.
Write the initial entry for the tests working time to the database
| integer | $user_id The database id of the user working with the test public |
Definition at line 3490 of file class.ilObjTest.php.
{
global $ilDB;
$q = sprintf("INSERT INTO tst_times (times_id, active_fi, started, finished, pass, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL)",
$ilDB->quote($active_id),
$ilDB->quote(strftime("%Y-%m-%d %H:%M:%S")),
$ilDB->quote(strftime("%Y-%m-%d %H:%M:%S")),
$ilDB->quote($pass)
);
$result = $ilDB->query($q);
return $ilDB->getLastInsertId();
}
| ilObjTest::testTitleExists | ( | $ | title | ) |
Returns TRUE if the test title exists in the database.
Returns TRUE if the test title exists in the database
| string | $title The title of the test |
Definition at line 964 of file class.ilObjTest.php.
References ilObject::$title.
{
global $ilDB;
$query = sprintf("SELECT * FROM object_data WHERE title = %s AND type = %s",
$ilDB->quote($title),
$ilDB->quote("tst")
);
$result = $ilDB->query($query);
if (strcmp(strtolower(get_class($result)), db_result) == 0) {
if ($result->numRows() == 1) {
return TRUE;
}
}
return FALSE;
}
| ilObjTest::toXML | ( | ) |
Returns a QTI xml representation of the test.
Returns a QTI xml representation of the test
Definition at line 5838 of file class.ilObjTest.php.
References _instanciateQuestion(), addQTIMaterial(), getAllowedUsers(), getAllowedUsersTimeGap(), getAnonymity(), getAnswerFeedback(), getAnswerFeedbackPoints(), getAuthor(), getCountSystem(), ilObject::getDescription(), getEndingTime(), getFixedParticipants(), getInstantFeedbackSolution(), getIntroduction(), getListOfQuestionsSettings(), getMCScoring(), getNrOfTries(), getPassScoring(), getPassword(), getRandomQuestionCount(), getReportingDate(), getResetProcessingTime(), getResultsPresentation(), getScoreCutting(), getScoreReporting(), getSequenceSettings(), getShowCancel(), getShowMarker(), getShuffleQuestions(), getStartingTime(), ilObject::getTitle(), getTitleOutput(), getUsePreviousAnswers(), and isRandomTest().
{
include_once("./classes/class.ilXmlWriter.php");
$a_xml_writer = new ilXmlWriter;
// set xml header
$a_xml_writer->xmlHeader();
$a_xml_writer->xmlSetDtdDef("<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array(
"ident" => "il_".IL_INST_ID."_tst_".$this->getTestId(),
"title" => $this->getTitle()
);
$a_xml_writer->xmlStartTag("assessment", $attrs);
// add qti comment
$a_xml_writer->xmlElement("qticomment", NULL, $this->getDescription());
// add qti duration
if ($this->enable_processing_time)
{
preg_match("/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
$a_xml_writer->xmlElement("duration", NULL, sprintf("P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
}
- // add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// anonymity
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "anonymity");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getAnonymity()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// random test
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "random_test");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->isRandomTest()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// sequence settings
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "sequence_settings");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getSequenceSettings());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// author
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "author");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// reset processing time
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "reset_processing_time");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getResetProcessingTime());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// count system
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "count_system");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getCountSystem());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// multiple choice scoring
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "mc_scoring");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getMCScoring());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// multiple choice scoring
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "score_cutting");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getScoreCutting());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// multiple choice scoring
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "password");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassword());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// allowed users
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsers");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsers());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// allowed users time gap
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsersTimeGap");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsersTimeGap());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// pass scoring
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "pass_scoring");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassScoring());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// score reporting date
if ($this->getReportingDate())
{
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "reporting_date");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
// number of tries
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "nr_of_tries");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getNrOfTries()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// use previous answers
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "use_previous_answers");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getUsePreviousAnswers());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// hide title points
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "title_output");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getTitleOutput()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// random question count
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "random_question_count");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getRandomQuestionCount()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// results presentation
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "results_presentation");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getResultsPresentation()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// solution details
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "show_summary");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getListOfQuestionsSettings()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// solution details
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "score_reporting");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getScoreReporting()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// solution details
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "instant_verification");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getInstantFeedbackSolution()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// answer specific feedback
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "answer_feedback");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getAnswerFeedback()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// answer specific feedback of reached points
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "answer_feedback_points");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getAnswerFeedbackPoints()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// show cancel
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "show_cancel");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getShowCancel()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// show marker
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "show_marker");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getShowMarker()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// fixed participants
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "fixed_participants");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getFixedParticipants()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// shuffle questions
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "shuffle_questions");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getShuffleQuestions()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
// starting time
if ($this->getStartingTime())
{
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "starting_time");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
// ending time
if ($this->getEndingTime())
{
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ending_time");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
foreach ($this->mark_schema->mark_steps as $index => $mark)
{
// mark steps
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "mark_step_$index");
$a_xml_writer->xmlElement("fieldentry", NULL, sprintf("<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>", $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
$a_xml_writer->xmlEndTag("qtimetadata");
// add qti objectives
$a_xml_writer->xmlStartTag("objectives");
$this->addQTIMaterial($a_xml_writer, $this->getIntroduction());
$a_xml_writer->xmlEndTag("objectives");
// add qti assessmentcontrol
if ($this->getInstantFeedbackSolution() == 1)
{
$attrs = array(
"solutionswitch" => "Yes"
);
}
else
{
$attrs = NULL;
}
$a_xml_writer->xmlElement("assessmentcontrol", $attrs, NULL);
$attrs = array(
"ident" => "1"
);
$a_xml_writer->xmlElement("section", $attrs, NULL);
$a_xml_writer->xmlEndTag("assessment");
$a_xml_writer->xmlEndTag("questestinterop");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
foreach ($this->questions as $question_id)
{
$question =& ilObjTest::_instanciateQuestion($question_id);
$qti_question = $question->toXML(false);
$qti_question = preg_replace("/<questestinterop>/", "", $qti_question);
$qti_question = preg_replace("/<\/questestinterop>/", "", $qti_question);
if (strpos($xml, "</section>") !== false)
{
$xml = str_replace("</section>", "$qti_question</section>", $xml);
}
else
{
$xml = str_replace("<section ident=\"1\"/>", "<section ident=\"1\">\n$qti_question</section>", $xml);
}
}
return $xml;
}
Here is the call graph for this function:| ilObjTest::unsetAccessCodeSession | ( | ) |
Definition at line 8525 of file class.ilObjTest.php.
References $_SESSION, ilObject::$id, and getTestId().
Here is the call graph for this function:| ilObjTest::update | ( | ) |
update object data
public
Reimplemented from ilObject.
Definition at line 510 of file class.ilObjTest.php.
{
if (!parent::update())
{
return false;
}
// put here object specific stuff
return true;
}
| ilObjTest::updateWorkingTime | ( | $ | times_id | ) |
Update the working time of a test when a question is answered.
Update the working time of a test when a question is answered
| integer | $times_id The database id of a working time entry public |
Definition at line 3512 of file class.ilObjTest.php.
{
global $ilDB;
$q = sprintf("UPDATE tst_times SET finished = %s WHERE times_id = %s",
$ilDB->quote(strftime("%Y-%m-%d %H:%M:%S")),
$ilDB->quote($times_id)
);
$result = $ilDB->query($q);
}
| ilObjTest::userLookupFullName | ( | $ | user_id, | |
| $ | overwrite_anonymity = FALSE, |
|||
| $ | sorted_order = FALSE, |
|||
| $ | suffix = "" | |||
| ) |
Returns the full name of a test user according to the anonymity status.
Returns the full name of a test user according to the anonymity status
| int | $user_id The database ID of the user | |
| boolean | $overwrite_anonymity Indicates if the anonymity status should be ignored |
Definition at line 8938 of file class.ilObjTest.php.
References ilObjUser::_lookupName(), and getAnonymity().
Referenced by removeSelectedTestResults(), and removeTestResultsForUser().
{
if ($this->getAnonymity() && !$overwrite_anonymity)
{
return $this->lng->txt("unknown") . $suffix;
}
else
{
include_once './Services/User/classes/class.ilObjUser.php';
$uname = ilObjUser::_lookupName($user_id);
if (strlen($uname["firstname"].$uname["lastname"]) == 0) $uname["firstname"] = $this->lng->txt("deleted_user");
if ($sorted_order)
{
return trim($uname["lastname"] . ", " . $uname["firstname"]) . $suffix;
}
else
{
return trim($uname["firstname"] . " " . $uname["lastname"]) . $suffix;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::$allowedUsers |
Definition at line 357 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$allowedUsersTimeGap |
Definition at line 364 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$anonymity |
Definition at line 378 of file class.ilObjTest.php.
| ilObjTest::$answer_feedback |
Definition at line 406 of file class.ilObjTest.php.
Referenced by setAnswerFeedback().
| ilObjTest::$answer_feedback_points |
Definition at line 147 of file class.ilObjTest.php.
Referenced by setAnswerFeedbackPoints().
| ilObjTest::$author |
Definition at line 66 of file class.ilObjTest.php.
Referenced by _lookupAuthor(), getAuthor(), and setAuthor().
| ilObjTest::$certificate_visibility |
Definition at line 371 of file class.ilObjTest.php.
| ilObjTest::$count_system |
Definition at line 300 of file class.ilObjTest.php.
| ilObjTest::$ects_fx |
Definition at line 263 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$ects_grades |
Definition at line 272 of file class.ilObjTest.php.
| ilObjTest::$ects_output |
Definition at line 254 of file class.ilObjTest.php.
Referenced by saveECTSStatus().
| ilObjTest::$enable_processing_time |
Definition at line 218 of file class.ilObjTest.php.
| ilObjTest::$ending_time |
Definition at line 245 of file class.ilObjTest.php.
Referenced by setEndingTime().
| ilObjTest::$evaluation_data |
Definition at line 168 of file class.ilObjTest.php.
| ilObjTest::$fixed_participants |
Definition at line 399 of file class.ilObjTest.php.
| ilObjTest::$instant_verification |
Definition at line 138 of file class.ilObjTest.php.
| ilObjTest::$introduction |
Definition at line 94 of file class.ilObjTest.php.
Referenced by setIntroduction().
| ilObjTest::$invitation = INVITATION_OFF |
Definition at line 55 of file class.ilObjTest.php.
| ilObjTest::$mark_schema |
Definition at line 103 of file class.ilObjTest.php.
Referenced by _getCompleteEvaluationData().
| ilObjTest::$mc_scoring |
Definition at line 307 of file class.ilObjTest.php.
| ilObjTest::$metadata |
Definition at line 75 of file class.ilObjTest.php.
Referenced by fromXML().
| ilObjTest::$nr_of_tries |
Definition at line 178 of file class.ilObjTest.php.
Referenced by setNrOfTries().
| ilObjTest::$pass_scoring |
Definition at line 314 of file class.ilObjTest.php.
| ilObjTest::$password |
Definition at line 350 of file class.ilObjTest.php.
| ilObjTest::$processing_time |
Definition at line 209 of file class.ilObjTest.php.
Referenced by isMaxProcessingTimeReached(), and setProcessingTime().
| ilObjTest::$questions |
Definition at line 84 of file class.ilObjTest.php.
| ilObjTest::$random_question_count |
Definition at line 292 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$random_test |
Definition at line 283 of file class.ilObjTest.php.
| ilObjTest::$reporting_date |
Definition at line 159 of file class.ilObjTest.php.
Referenced by setReportingDate().
| ilObjTest::$reset_processing_time |
Definition at line 227 of file class.ilObjTest.php.
| ilObjTest::$results_presentation |
Definition at line 329 of file class.ilObjTest.php.
| ilObjTest::$score_cutting |
Definition at line 343 of file class.ilObjTest.php.
| ilObjTest::$score_reporting |
Definition at line 127 of file class.ilObjTest.php.
Referenced by setScoreReporting().
| ilObjTest::$sequence_settings |
Definition at line 114 of file class.ilObjTest.php.
Referenced by setSequenceSettings().
| ilObjTest::$show_cancel |
Definition at line 385 of file class.ilObjTest.php.
| ilObjTest::$show_marker |
Definition at line 392 of file class.ilObjTest.php.
| ilObjTest::$show_summary |
Definition at line 336 of file class.ilObjTest.php.
| ilObjTest::$shuffle_questions |
Definition at line 322 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$starting_time |
Definition at line 236 of file class.ilObjTest.php.
Referenced by canShowTestResults(), isExecutable(), isMaxProcessingTimeReached(), and setStartingTime().
| ilObjTest::$test_id |
Definition at line 46 of file class.ilObjTest.php.
Referenced by _evalResultsOverview(), _getActiveIdOfUser(), _getBestPass(), _getCompleteEvaluationData(), _getCompleteWorkingTimeOfParticipants(), _getObjectIDFromTestID(), _getPassedUsers(), _getQuestionCount(), _getTestIDFromObjectID(), and _getVisitTimeOfParticipant().
| ilObjTest::$testSequence |
Definition at line 420 of file class.ilObjTest.php.
Referenced by getTestResult().
| ilObjTest::$testSession |
Definition at line 413 of file class.ilObjTest.php.
Referenced by createTestSession(), and setTestSession().
| ilObjTest::$title_output |
Definition at line 200 of file class.ilObjTest.php.
Referenced by setTitleOutput().
| ilObjTest::$use_previous_answers |
Definition at line 188 of file class.ilObjTest.php.
Referenced by _getUsePreviousAnswers(), and setUsePreviousAnswers().
1.7.1