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 | |
ilClone ($a_parent_ref) | |
copy all entries of your 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. | |
retrieveTestTypes () | |
Retrieves the test types from the database. | |
testTitleExists ($title) | |
Returns TRUE if the test title exists in the database. | |
duplicate () | |
Duplicates the ilObjTest object. | |
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. | |
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. | |
generateRandomQuestions ($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. | |
& | getQuestions ($active_id="", $pass=NULL, $userorder=FALSE) |
Returns the the question ids of the test. | |
setAuthor ($author="") | |
Sets the authors name. | |
setIntroduction ($introduction="") | |
Sets the introduction. | |
getAuthor () | |
Gets the authors name. | |
isRandomTest () | |
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. | |
setSequenceSettings ($sequence_settings=0) | |
Sets the sequence settings. | |
setTestType ($type=TYPE_ASSESSMENT) | |
Sets the test type. | |
setScoreReporting ($score_reporting=0) | |
Sets the score reporting. | |
setInstantVerification ($instant_verification=0) | |
Sets the instant verification. | |
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. | |
getInstantVerification () | |
Gets the instant verification. | |
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. | |
getTestType () | |
Gets the test type. | |
_lookupTestType ($a_obj_id) | |
Lookup test type. | |
_lookupTestIdForQuestion ($a_question_id) | |
Lookup test id for question. | |
_lookupAuthor ($obj_id) | |
Gets the authors name. | |
getReportingDate () | |
Gets the reporting date. | |
getNrOfTries () | |
Returns the nr of tries for the test. | |
getHidePreviousResults () | |
Returns if the previous results should be hidden for a learner. | |
getHideTitlePoints () | |
Returns true if the maximum points of a question should be hidden in the question title. | |
_getHideTitlePoints ($active_id) | |
Returns true if the maximum points of a question should be hidden in the question title. | |
_getHidePreviousResults ($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). | |
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. | |
setHidePreviousResults ($hide_previous_results=0) | |
Sets the status of the visibility of previous learner results. | |
setHideTitlePoints ($hide_title_points=0) | |
Sets the status of the visibility of the maximum points in the question title. | |
setProcessingTime ($processing_time="00:00:00") | |
Sets the processing time for the test. | |
setEnableProcessingTime ($enable=0) | |
Sets the processing time enabled or disabled. | |
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. | |
clearEvalSelectedUsers () | |
Removes all selected users for the test evaluation. | |
removeAllTestEditings ($question_id="") | |
Removes all references to the question in executed tests in case the question has been changed. | |
removeSelectedTestResults ($active_ids) | |
Removes all references to the question in executed tests in case the question has been changed. | |
removeTestResultsForUser ($user_id) | |
Removes all references to the question in executed tests in case the question has been changed. | |
deleteActiveTests () | |
Deletes all active references to this test. | |
deleteResults ($user_id="") | |
Removes all question solutions for a given user. | |
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. | |
getQuestionDataset ($question_id) | |
Returns the dataset for a given question id. | |
& | get_qpl_titles () |
Get the titles of all available questionpools for the current user. | |
& | 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 ($user_id) | |
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. | |
getQuestionIdFromActiveUserSequence ($sequence) | |
Calculate the question id from a test sequence number. | |
& | getAllQuestionsForActiveUser () |
Returns all questions of a test in users order. | |
getFirstSequence () | |
& | 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. | |
& | getActiveTestUserFromActiveId ($active_id) |
getActiveTestUser ($user_id="", $anonymous_id="") | |
Gets the database row of the tst_active table for the active user. | |
getActiveIdOfUser ($user_id="", $anonymous_id="") | |
Gets the active id of a given user. | |
_getActiveTestUser ($user_id="", $test_id="") | |
Gets the database row of the tst_active table for the active user. | |
setActiveTestUser ($lastindex=1, $postpone="", $addTries=false) | |
Update the data of the tst_active table for the current user. | |
addQuestionSequence ($active_id) | |
Adds the sequence of questions for a random test to an existing active dataset. | |
pcArrayShuffle ($array) | |
Shuffles the values of a given array. | |
& | getTestResult ($active_id, $pass=NULL) |
Calculates the results of a test for a given user. | |
& | getTestSummary ($active_id, $pass=NULL) |
Calculates the overview of a test for a given user. | |
evalTotalPersons () | |
Returns the number of persons who started the test. | |
canViewResults () | |
Returns true, if the test results can be viewed. | |
evalLoadStatisticalSettings ($user_id) | |
Retrieves the user settings for the statistical evaluation tool. | |
evalSaveStatisticalSettings ($settings_array, $user_id) | |
Saves the user settings for the statistical evaluation tool. | |
getCompleteWorkingTime ($user_id) | |
Returns the complete working time in seconds a user worked on the test. | |
& | evalStatistical ($active_id) |
Returns the statistical evaluation of the test for a specified user. | |
& | getTotalPointsArray () |
Returns an array with the total points of all users who participated the test. | |
& | getTotalPointsPassedArray () |
Returns an array with the total points of all users who passed 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. | |
evalTotalStartedAverageTime () | |
Returns the average processing time for all started tests. | |
evalTotalPassedAverageTime () | |
Returns the average processing time for all passed tests. | |
& | getAvailableQuestionpoolIDs () |
Returns the object id's of the available question pools for the active user. | |
& | getAvailableQuestionpools ($use_object_id=false, $equal_points=false, $could_be_offline=false, $with_questioncount=FALSE) |
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, $filter_text, $sel_filter_type, $startrow=0, $completeonly=0, $filter_question_type="", $filter_questionpool="") | |
Calculates the data for the output of the questionpool. | |
_getTestType ($active_id) | |
Returns the test type for a given test id. | |
& | _getQuestiontypes () |
Creates a list of all available question types. | |
fromXML (&$assessment) | |
Creates a test from a QTI file. | |
to_xml () | |
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 () | |
updateMetaData () | |
update meta data entry | |
& | _getAvailableTests ($use_object_id=false) |
Returns the available tests for the active user. | |
cloneRandomQuestions ($new_id) | |
Duplicates the source random questionpools for another test. | |
_clone ($obj_id) | |
Creates a 1:1 copy of the object and places the copy in a given repository. | |
_getRefIdFromObjId ($obj_id) | |
& | getEvaluationUsers ($user_id, $sort_name_option="asc") |
Returns an array of users who are selected for a test evaluation of a given user. | |
& | getEvaluationParticipants ($user_id, $sort_name_option="asc") |
Returns an array of users who are selected for a test evaluation of a given user. | |
removeSelectedUser ($user_id, $evaluator_id) | |
Disinvites a user from a evaluation. | |
addSelectedUser ($user_id, $evaluator_id) | |
Invites a user to a evaluation. | |
addSelectedGroup ($group_id, $evaluator_id) | |
Invites a group to a evaluation. | |
addSelectedRole ($role_id, $evaluator_id) | |
Adds a role to a evaluation. | |
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. | |
& | 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) | |
isOnlineTest () | |
gets TestType equals Online Test | |
_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 | |
getAllTestResults ($participants, $skip_csv=false) | |
returns all test results for all participants | |
& | 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. | |
_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) | |
Checks if the test is executable by the given user. | |
canShowTestResults ($user_id) | |
canEditMarks () | |
getStartingTimeOfUser ($user_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. | |
getShowSolutionDetails () | |
Returns if the solution details should be presented to the user or not. | |
getShowSummary () | |
Returns if the question summary should be presented to the user or not. | |
getShowSolutionPrintview () | |
Returns if the solution printview should be presented to the user or not. | |
setShowSolutionDetails ($a_details=TRUE) | |
Sets if the the solution details should be presented to the user or not. | |
setShowSummary ($a_summary=TRUE) | |
Sets if the the question summary 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=TRUE) | |
Sets if the the solution printview should be presented to the user or not. | |
& | _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. | |
& | 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. | |
buildName ($user_id, $firstname, $lastname, $title) | |
Builds a user name for the output. | |
_buildName ($test_type, $user_id, $firstname, $lastname, $title) | |
Builds a user name for the output. | |
& | _getCompleteEvaluationData ($test_id, $withStatistics=TRUE, $active_id="") |
& | getCompleteEvaluationData ($withStatistics=TRUE) |
& | 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. | |
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. | |
Data Fields | |
$test_id | |
$invitation = INVITATION_OFF | |
$author | |
$metadata | |
$questions | |
$introduction | |
$mark_schema | |
$sequence_settings | |
$score_reporting | |
$instant_verification | |
$reporting_date | |
$evaluation_data | |
$test_type | |
$nr_of_tries | |
$hide_previous_results | |
$hide_title_points | |
$processing_time | |
$enable_processing_time | |
$starting_time | |
$ending_time | |
$ects_output | |
$ects_fx | |
$test_types | |
$ects_grades | |
$random_test | |
$random_question_count | |
$count_system | |
$mc_scoring | |
$pass_scoring | |
$shuffle_questions | |
$show_solution_details | |
$show_summary | |
$show_solution_printview | |
$score_cutting | |
$password | |
$allowedUsers | |
$allowedUsersTimeGap |
Definition at line 38 of file class.ilObjTest.php.
ilObjTest::_buildName | ( | $ | test_type, | |
$ | 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 8123 of file class.ilObjTest.php.
References ilObject::$lng, $test_type, ilObject::$title, and $user_id.
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 ($test_type == TYPE_SELF_ASSESSMENT) { $name = $lng->txt("anonymous"); } } return $name; }
ilObjTest::_clone | ( | $ | obj_id | ) |
Creates a 1:1 copy of the object and places the copy in a given repository.
Creates a 1:1 copy of the object and places the copy in a given repository
public
Definition at line 6128 of file class.ilObjTest.php.
References $_GET, $counter, $key, $obj_id, assQuestion::_getOriginalId(), _instanciateQuestion(), and ilObjTest().
Referenced by ilObjTestGUI::cloneAllObject().
{ $original = new ilObjTest($obj_id, false); $original->loadFromDb(); $newObj = new ilObjTest(); $newObj->setType("tst"); $counter = 2; while ($newObj->testTitleExists($newObj->getTitle() . " ($counter)")) { $counter++; } $newObj->setAuthor($original->getAuthor()); $newObj->setHideTitlePoints($original->getHideTitlePoints()); $newObj->setPassScoring($original->getPassScoring()); $newObj->setTitle($original->getTitle() . " ($counter)"); $newObj->setDescription($original->getDescription()); $newObj->create(true); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); $newObj->author = $original->getAuthor(); $newObj->introduction = $original->getIntroduction(); $newObj->mark_schema = $original->mark_schema; $newObj->sequence_settings = $original->getSequenceSettings(); $newObj->score_reporting = $original->getScoreReporting(); $newObj->instant_verification = $original->getInstantVerification(); $newObj->reporting_date = $original->getReportingDate(); $newObj->test_type = $original->getTestType(); $newObj->nr_of_tries = $original->getNrOfTries(); $newObj->setHidePreviousResults($original->getHidePreviousResults()); $newObj->processing_time = $original->getProcessingTime(); $newObj->enable_processing_time = $original->getEnableProcessingTime(); $newObj->starting_time = $original->getStartingTime(); $newObj->ending_time = $original->getEndingTime(); $newObj->ects_output = $original->ects_output; $newObj->ects_fx = $original->ects_fx; $newObj->ects_grades = $original->ects_grades; $newObj->random_test = $original->random_test; $newObj->random_question_count = $original->random_question_count; $newObj->setCountSystem($original->getCountSystem()); $newObj->setMCScoring($original->getMCScoring()); $newObj->saveToDb(); if ($original->isRandomTest()) { $newObj->saveRandomQuestionCount($newObj->random_question_count); $original->cloneRandomQuestions($newObj->getTestId()); } else { // clone the questions include_once "./assessment/classes/class.assQuestion.php"; foreach ($original->questions as $key => $question_id) { $question = ilObjTest::_instanciateQuestion($question_id); $newObj->questions[$key] = $question->duplicate(); // $question->id = -1; $original_id = assQuestion::_getOriginalId($question_id); $question = ilObjTest::_instanciateQuestion($newObj->questions[$key]); $question->saveToDb($original_id); } } $newObj->saveToDb(); // clone meta data include_once "./Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($original->getId(),0,$original->getType()); $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType()); return $newObj->getRefId(); }
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 831 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
Referenced by ilObjTestGUI::uploadTstObject().
{ global $ilias; include_once "./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); } }
& 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 8030 of file class.ilObjTest.php.
References $query, $result, $row, and $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; }
ilObjTest::_getActiveTestUser | ( | $ | user_id = "" , |
|
$ | test_id = "" | |||
) |
Gets the database row of the tst_active table for the active user.
Gets the database row 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 3790 of file class.ilObjTest.php.
References $query, $result, $test_id, and $user_id.
Referenced by ilObjTestAccess::_checkCondition(), and ilSoapUtils::saveQuestionResult().
{ global $ilDB; global $ilUser; if (!$user_id) { $user_id = $ilUser->id; } if (!$test_id) { return ""; } $query = sprintf("SELECT * 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()) { return $result->fetchRow(DB_FETCHMODE_OBJECT); } else { return ""; } }
& ilObjTest::_getArrayData | ( | $ | query, | |
$ | id_field | |||
) |
Definition at line 6799 of file class.ilObjTest.php.
References $query, $result, and $row.
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(); }
& 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 6061 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, and ilObject::_hasUntrashedReference().
Referenced by ilObjTestGUI::createObject(), and ilObjAssessmentFolderGUI::logsObject().
{ global $rbacsystem; global $ilDB; $result_array = array(); $query = "SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.type = 'tst' ORDER BY object_data.title"; $result = $ilDB->query($query); include_once "./classes/class.ilObject.php"; while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) { if ($rbacsystem->checkAccess("write", $row->ref_id) && (ilObject::_hasUntrashedReference($row->obj_id))) { if ($use_object_id) { $result_array[$row->obj_id] = $row->title; } else { $result_array[$row->ref_id] = $row->title; } } } return $result_array; }
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 7188 of file class.ilObjTest.php.
References $query, $result, $results, $row, $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; } }
& ilObjTest::_getCompleteEvaluationData | ( | $ | test_id, | |
$ | withStatistics = TRUE , |
|||
$ | active_id = "" | |||
) |
Definition at line 8149 of file class.ilObjTest.php.
References $data, $mark_schema, $query, $result, $row, $test_id, _buildName(), _getCompleteWorkingTimeOfParticipants(), _getECTSGrade(), _getQuestionCount(), and _getVisitTimeOfParticipant().
Referenced by _getBestPass(), ilObjTestAccess::_getPassedUsers(), and _getPassedUsers().
{ 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 "./assessment/classes/class.assMarkSchema.php"; $mark_schema = new ASS_MarkSchema(); $mark_schema->loadFromDb($test_id); include_once "./assessment/classes/class.ilTestEvaluationPassData.php"; include_once "./assessment/classes/class.ilTestEvaluationUserData.php"; include_once "./assessment/classes/class.ilTestEvaluationData.php"; if ($active_id > 0) $withStatistics = FALSE; $data = new ilTestEvaluationData($test_id); $query = ""; 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; $participant = NULL; $pass = NULL; while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { if (!$data->participantExists($row["active_fi"])) { $data->addParticipant($row["active_fi"], new ilTestEvaluationUserData()); $participant =& $data->getParticipant($row["active_fi"]); $participant->setName(ilObjTest::_buildName($testdata["test_type_fi"], $row["usr_id"], $row["firstname"], $row["lastname"], $row["title"])); $participant->setLogin($row["login"]); $participant->setUserID($row["usr_id"]); } if (!is_object($participant->getPass($row["pass"]))) { $participant->addPass($row["pass"], new ilTestEvaluationPassData($row["pass"])); $pass =& $participant->getPass($row["pass"]); } $pass->addAnsweredQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["maxpoints"], $row["points"]); } if ($testdata["test_type_fi"] != TYPE_VARYING_RANDOMTEST) { // ILIAS fix to deal with "old style" tests where a user expects that in a new test pass // the old question answers are part of this pass and only overwritten when a question is answered again foreach ($data->getParticipantIds() as $active_id) { $participant =& $data->getParticipant($active_id); $lastpass = $participant->getLastPass(); if ($lastpass > 0) { $passdatalast =& $participant->getPass($lastpass); $answeredids = array(); foreach ($passdatalast->getAnsweredQuestions() as $foundquestion) { array_push($answeredids, $foundquestion["id"]); } $pointsarray = array(); $reachedarray = array(); for ($pc = 0; $pc <= $lastpass; $pc++) { $passdataactual =& $participant->getPass($pc); if ($passdataactual != null) { foreach ($passdataactual->getAnsweredQuestions() as $foundquestion) { $pointsarray[$foundquestion["id"]] = $foundquestion["points"]; $reachedarray[$foundquestion["id"]] = $foundquestion["reached"]; } } } foreach ($pointsarray as $question_id => $question_points) { if (!in_array($question_id, $answeredids)) { $passdatalast->addAnsweredQuestion($question_id, $question_points, $reachedarray[$question_id]); } } } } } foreach ($data->getParticipantIds() as $active_id) { $participant =& $data->getParticipant($active_id); if ($testdata["random_test"]) { for ($testpass = 0; $testpass <= $data->getLastPassOfParticipant($active_id); $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, qpl_question_type.type_tag " . "FROM tst_test_random_question, qpl_questions, qpl_question_type " . "WHERE tst_test_random_question.question_fi = qpl_questions.question_id " . "AND tst_test_random_question.pass = %s " . "AND qpl_questions.question_type_fi = qpl_question_type.question_type_id " . "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)) { $rpass = array_key_exists("pass", $row) ? $row["pass"] : 0; $data->addQuestionForParticipant($active_id, $row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $rpass, $row["type_tag"], $row["question_fi"]); $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, qpl_question_type.type_tag " . "FROM tst_test_question, tst_active, qpl_questions, qpl_question_type " . "WHERE tst_test_question.question_fi = qpl_questions.question_id " . "AND qpl_questions.question_type_fi = qpl_question_type.question_type_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()) { while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $rpass = array_key_exists("pass", $row) ? $row["pass"] : 0; $participant->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $rpass, $row["type_tag"], $row["question_fi"]); $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) { $xpass = 0; $participant =& $data->getParticipant($active_id); if ($testdata["pass_scoring"] == SCORE_BEST_PASS) { $xpass = $participant->getBestPass(); } else { $xpass = $participant->getLastPass(); } $participant->setReached($participant->getReachedPoints($xpass)); $participant->setMaxPoints($participant->getAvailablePoints($xpass)); $percentage = $participant->getMaxPoints() ? $participant->getReached() / $participant->getMaxPoints() * 100.0 : 0; $mark = $mark_schema->getMatchingMark($percentage); if (is_object($mark)) { $participant->setMark($mark->getShortName()); $participant->setMarkOfficial($mark->getOfficialName()); $participant->setPassed($mark->getPassed()); } $userpass =& $participant->getPass($xpass); if (is_object($userpass)) $participant->setQuestionsWorkedThrough($userpass->getAnsweredQuestionCount()); $questionpass = $xpass; if (!is_array($participant->getQuestions($xpass))) { $questionpass = 0; } $participant->setNumberOfQuestions(count($participant->getQuestions($questionpass))); $participant->setTimeOfWork($workingTimes[$active_id]); $visitingTime =& ilObjTest::_getVisitTimeOfParticipant($test_id, $active_id); $participant->setFirstVisit($visitingTime["firstvisit"]); $participant->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; }
& 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
Definition at line 8582 of file class.ilObjTest.php.
References $query, $result, $row, and $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; }
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 2188 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by assQuestion::calculateReachedPoints(), and assQuestion::getSolutionCommentCountSystem().
{ 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; }
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 5971 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($passed_array) && ($reached_points >= $ects_percentiles["A"])) { return "A"; } else if (count($passed_array) && ($reached_points >= $ects_percentiles["B"])) { return "B"; } else if (count($passed_array) && ($reached_points >= $ects_percentiles["C"])) { return "C"; } else if (count($passed_array) && ($reached_points >= $ects_percentiles["D"])) { return "D"; } else if (count($passed_array) && ($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"; } }
ilObjTest::_getHidePreviousResults | ( | $ | 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_hide_previous_results of the active user should be used as well |
Definition at line 2509 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by 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; $user_hide_previous_results = 0; if ($user_active_user_setting) { if (array_key_exists("tst_hide_previous_results", $ilUser->prefs)) { $user_hide_previous_results = $ilUser->prefs["tst_hide_previous_results"]; } } $query = sprintf("SELECT tst_tests.hide_previous_results 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); if ($row["hide_previous_results"] != 1) { return $row["hide_previous_results"] | $user_hide_previous_results; } else { return $row["hide_previous_results"]; } } return 0; }
ilObjTest::_getHideTitlePoints | ( | $ | active_id | ) |
Returns true if the maximum points of a question should be hidden in the question title.
Returns true if the maximum points of a question should be hidden in the question title
integer | The test id |
Definition at line 2482 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by assQuestionGUI::outQuestionPage().
{ global $ilDB; $query = sprintf("SELECT tst_tests.hide_title_points 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["hide_title_points"]; } return 0; }
ilObjTest::_getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 862 of file class.ilObjTest.php.
References ilUtil::getDataDir().
Referenced by assTextSubset::fromXML(), assTextQuestion::fromXML(), assSingleChoice::fromXML(), assOrderingQuestion::fromXML(), assNumeric::fromXML(), assMultipleChoice::fromXML(), assMatchingQuestion::fromXML(), assJavaApplet::fromXML(), assImagemapQuestion::fromXML(), assClozeTest::fromXML(), ilObjTestGUI::importVerifiedFileObject(), and ilObjTestGUI::uploadTstObject().
{ include_once "./classes/class.ilUtil.php"; $import_dir = ilUtil::getDataDir()."/tst_data/tst_import"; if(@is_dir($import_dir)) { return $import_dir; } else { return false; } }
ilObjTest::_getLastAccess | ( | $ | active_id | ) |
Definition at line 7859 of file class.ilObjTest.php.
ilObjTest::_getMCScoring | ( | $ | active_id | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 2292 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by assMultipleChoice::calculateReachedPoints(), and assQuestion::getSolutionCommentMCScoring().
{ 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; }
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 6592 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by 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; }
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 6567 of file class.ilObjTest.php.
References $query, $result, $row, and $test_id.
Referenced by 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; }
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 7160 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by _getResultPass(), deleteResults(), assJavaAppletGUI::getSolutionOutput(), assImagemapQuestionGUI::getSolutionOutput(), assTextSubsetGUI::getTestOutput(), assTextQuestionGUI::getTestOutput(), assSingleChoiceGUI::getTestOutput(), assOrderingQuestionGUI::getTestOutput(), assNumericGUI::getTestOutput(), assMultipleChoiceGUI::getTestOutput(), assMatchingQuestionGUI::getTestOutput(), assJavaAppletGUI::getTestOutput(), assImagemapQuestionGUI::getTestOutput(), assClozeTestGUI::getTestOutput(), 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; } }
& 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 | $a_obj_id The ILIAS ID of the test object |
Definition at line 7697 of file class.ilObjTest.php.
References $results, $test_id, _getCompleteEvaluationData(), and _getTestIDFromObjectID().
Referenced by evalTotalPassedAverageTime().
{ $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; }
ilObjTest::_getPassScoring | ( | $ | active_id | ) |
Gets the pass scoring type.
Gets the pass scoring type
Definition at line 2268 of file class.ilObjTest.php.
References $query, $result, and $row.
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; }
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 6420 of file class.ilObjTest.php.
References $add, $counter, $data, $query, $result, $row, and $test_id.
Referenced by _getCompleteEvaluationData(), ilTestOutputGUI::outWorkingForm(), ilTestOutputGUI::redirectQuestion(), 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; }
& ilObjTest::_getQuestiontypes | ( | ) |
Creates a list of all available question types.
Creates a list of all available question types
Definition at line 5326 of file class.ilObjTest.php.
{ global $ilDB; $questiontypes = array(); $query = "SELECT * FROM qpl_question_type ORDER BY type_tag"; $query_result = $ilDB->query($query); while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC)) { $questiontypes[$this->lng->txt($row["type_tag"])] = $row; } ksort($questiontypes); return $questiontypes; }
ilObjTest::_getRefIdFromObjId | ( | $ | obj_id | ) |
Definition at line 6200 of file class.ilObjTest.php.
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 7226 of file class.ilObjTest.php.
References $query, $result, _getBestPass(), _getPass(), _getPassScoring(), and _getTestType().
Referenced by evalStatistical(), ilTestEvaluationGUI::evalUserDetail(), and ilTestOutputGUI::outResultsOverview().
{ $counted_pass = NULL; if (strcmp(ilObjTest::_getTestType($active_id), "tt_varying_randomtest") == 0) { if (ilObjTest::_getPassScoring($active_id) == SCORE_BEST_PASS) { $counted_pass = ilObjTest::_getBestPass($active_id); } else { $counted_pass = ilObjTest::_getPass($active_id); 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($counted_pass . "") ); $result = $ilDB->query($query); if ($result->numRows() == 0) { // There was no answer answered in the actual pass, so the last pass is // $counted_pass - 1 $counted_pass -= 1; } if ($counted_pass < 0) $counted_pass = 0; } } return $counted_pass; }
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 2316 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by assQuestion::calculateReachedPoints(), and assQuestion::getSolutionCommentScoreCutting().
{ 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; }
ilObjTest::_getSolvedQuestions | ( | $ | active_id, | |
$ | question_fi = null | |||
) |
get solved questions
Definition at line 6949 of file class.ilObjTest.php.
References $query, and _getArrayData().
Referenced by getTestSummary(), 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"); }
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 6617 of file class.ilObjTest.php.
References $query, $result, $row, and $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; }
ilObjTest::_getTestType | ( | $ | active_id | ) |
Returns the test type for a given test id.
Returns the test type for a given test id
integer | $test_id The database id of the test |
Definition at line 5301 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by _getResultPass(), assJavaAppletGUI::getSolutionOutput(), and assJavaAppletGUI::getTestOutput().
{ global $ilDB; $result = ""; $query = sprintf("SELECT tst_test_type.type_tag FROM tst_test_type, tst_tests, tst_active WHERE tst_test_type.test_type_id = tst_tests.test_type_fi AND tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s", $ilDB->quote($active_id . "") ); $query_result = $ilDB->query($query); if ($query_result->numRows()) { $row = $query_result->fetchRow(DB_FETCHMODE_ASSOC); $result = $row["type_tag"]; } return $result; }
ilObjTest::_getUserIdFromActiveId | ( | $ | active_id | ) |
Definition at line 7759 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by assTextQuestion::_setReachedPoints(), ilTestEvaluationGUI::evalUserDetail(), 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; } }
ilObjTest::_getVisitTimeOfParticipant | ( | $ | test_id, | |
$ | active_id | |||
) |
Returns the first and last visit of a participant.
Returns the first and last visit of a participant
Definition at line 8628 of file class.ilObjTest.php.
References $query, $result, $row, and $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); }
& 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 5009 of file class.ilObjTest.php.
References assQuestion::_getQuestionType().
Referenced by ilCourseObjectiveQuestion::__read(), _clone(), ilCourseObjectivesGUI::askDeassignQuestion(), ilCourseObjectivesGUI::assignQuestionSelect(), ilObjQuestionPool::deleteQuestion(), duplicateQuestionForTest(), getAllTestResults(), getEstimatedWorkingTime(), ilCourseObjectiveQuestion::getMaxPointsByObjective(), ilCourseObjectiveQuestion::getMaxPointsByTest(), getTestSummary(), ilCourseObjectivesGUI::listAssignedQuestions(), removeQuestion(), and to_xml().
{ if (strcmp($question_id, "") != 0) { include_once "./assessment/classes/class.assQuestion.php"; $question_type = assQuestion::_getQuestionType($question_id); if(!strlen($question_type)) { return false; } include_once "./assessment/classes/class.".$question_type.".php"; $question = new $question_type(); $question->loadFromDb($question_id); return $question; } }
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 1054 of file class.ilObjTest.php.
References $obj_id, and ilObjTest().
ilObjTest::_lookupAuthor | ( | $ | obj_id | ) |
Gets the authors name.
Gets the authors name of the ilObjTest object
Definition at line 2400 of file class.ilObjTest.php.
References $obj_id, $query, $result, and $row.
Referenced by assQuestion::getInstances().
{ global $ilDB; $query = sprintf("SELECT author FROM tst_tests WHERE obj_fi = %s", $ilDB->quote($obj_id . "") ); $result = $ilDB->query($query); if ($result->numRows()) { $row = $result->fetchRow(DB_FETCHMODE_ASSOC); return $row["author"]; } return ""; }
ilObjTest::_lookupTestIdForQuestion | ( | $ | a_question_id | ) |
Lookup test id for question.
integer | obj_id of question |
Definition at line 2375 of file class.ilObjTest.php.
References $query, $res, and $row.
{ global $ilDB; $query = sprintf("SELECT tst_tests.obj_fi FROM tst_tests, tst_test_question WHERE tst_test_question.test_fi = tst_tests.test_id AND tst_test_question.question_fi = %s", $ilDB->quote($a_question_id) ); $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { return $row['obj_fi']; } return 0; }
ilObjTest::_lookupTestType | ( | $ | a_obj_id | ) |
Lookup test type.
integer | obj_id of test |
Definition at line 2353 of file class.ilObjTest.php.
References $query, $res, and $row.
Referenced by ilLPListOfSettingsGUI::__checkItemAnonymized(), ilLPCollections::__read(), ilLPTestListGUI::__readAnonymized(), ilLPCollections::_getItems(), ilLearningProgressBaseGUI::isObjectAnonymized(), and ilLPFilter::searchFilterListener().
{ global $ilDB; $query = "SELECT test_type_fi FROM tst_tests ". "WHERE obj_fi = '".$a_obj_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { return $row['test_type_fi']; } return 0; }
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 7934 of file class.ilObjTest.php.
References $mobs, ilObjMediaObject::_getMobsOfObject(), ilRTE::_replaceMediaObjectImageSrc(), ilObject::getId(), and isHTML().
Referenced by to_xml().
{ include_once "./Services/RTE/classes/class.ilRTE.php"; include_once("./content/classes/Media/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"); }
ilObjTest::addQuestionSequence | ( | $ | active_id | ) |
Adds the sequence of questions for a random test to an existing active dataset.
Adds the sequence of questions for a random test to an existing active dataset This is called when the initial question sequence for a random test has to be created. The generation of the questions depends on the active id of the user which means that the active dataset has to be created before the question sequence exists.
int | $active_id The active id of the user private |
Definition at line 3915 of file class.ilObjTest.php.
References $ilLog, $query, getQuestionCount(), getShuffleQuestions(), isRandomTest(), loadQuestions(), and pcArrayShuffle().
Referenced by generateRandomQuestions().
{ if ($this->isRandomTest()) { global $ilUser; global $ilDB; $this->loadQuestions($active_id, 0); if ((count($this->questions)) > $this->getQuestionCount()) { // something went terribly wrong, so create a sequence with only the maximum number of allowed questions // This section was introduced due to some random problems with the question sequence (HS, 2007-02-06) global $ilLog; $ilLog->write("fatal error: The number of questions is greater than the allowed question count. user id = " . $ilUser->getId() . ", active id = $active_id, questions = " . print_r($this->questions, true)); $sequence_arr = array(); for ($i = 1; $i <= $this->getQuestionCount(); $i++) { $sequence_arr[$i] = $i; } } else { $sequence_arr = array_flip($this->questions); } if ($this->getShuffleQuestions()) { $sequence_arr = array_values($sequence_arr); $sequence_arr = $this->pcArrayShuffle($sequence_arr); } $sequence = join($sequence_arr, ","); $query = sprintf("UPDATE tst_active SET sequence = %s WHERE active_id = %s", $ilDB->quote($sequence . ""), $ilDB->quote($active_id . "") ); $ilDB->query($query); } }
ilObjTest::addSelectedGroup | ( | $ | group_id, | |
$ | evaluator_id | |||
) |
Invites a group to a evaluation.
Invites a group to a evaluation
integer | $group_id The database id of the invited group public |
Definition at line 6341 of file class.ilObjTest.php.
References $user_id, and addSelectedUser().
{ include_once "./classes/class.ilObjGroup.php"; $group = new ilObjGroup($group_id); $members = $group->getGroupMemberIds(); foreach ($members as $user_id) { $this->addSelectedUser($user_id, $evaluator_id); } }
ilObjTest::addSelectedRole | ( | $ | role_id, | |
$ | evaluator_id | |||
) |
Adds a role to a evaluation.
Adds a role to a evaluation
integer | $role_id The database id of the role to add public |
Definition at line 6360 of file class.ilObjTest.php.
References $rbacreview, $role_id, $user_id, and addSelectedUser().
{ global $rbacreview; $members = $rbacreview->assignedUsers($role_id,"usr_id"); foreach ($members as $user_id) { $this->addSelectedUser($user_id, $evaluator_id); } }
ilObjTest::addSelectedUser | ( | $ | user_id, | |
$ | evaluator_id | |||
) |
Invites a user to a evaluation.
Invites a user to a evaluation
integer | $user_id The database id of the invited user public |
Definition at line 6313 of file class.ilObjTest.php.
References $query, $result, and $user_id.
Referenced by addSelectedGroup(), and addSelectedRole().
{ global $ilDB; $query = sprintf("SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s", $ilDB->quote($this->getTestId() . ""), $ilDB->quote($user_id . "") ); $result = $ilDB->query($query); if ($result->numRows() == 1) { $query = sprintf("REPLACE INTO tst_eval_users (test_fi, evaluator_fi, user_fi) VALUES (%s, %s, %s)", $ilDB->quote($this->getTestId() . ""), $ilDB->quote($evaluator_id . ""), $ilDB->quote($user_id . "") ); $result = $ilDB->query($query); } }
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 8085 of file class.ilObjTest.php.
References $row, ilObject::$title, $user_id, and getTestType().
Referenced by getCompleteEvaluationData().
{ $name = ""; if (strlen($firstname.$lastname.$title) == 0) { $name = $this->lng->txt("deleted_user"); } else { if ($user_id == ANONYMOUS_USER_ID) { $name = $row["lastname"]; } else { $name = trim($lastname . ", " . $firstname . " " . $title); } if ($this->getTestType() == TYPE_SELF_ASSESSMENT) { $name = $this->lng->txt("anonymous"); } } return $name; }
ilObjTest::canEditMarks | ( | ) |
Definition at line 7405 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; } }
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 7633 of file class.ilObjTest.php.
References $query, $result, $user_id, canShowTestResults(), getShowSolutionPrintview(), and isOnlineTest().
{ global $ilDB; if (!is_numeric($user_id)) { global $ilUser; $user_id = $ilUser->getId(); } if ($this->isOnlineTest()) { $query = sprintf("SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=1", $ilDB->quote($this->getTestId() . ""), $ilDB->quote($user_id . "") ); $result = $ilDB->query($query); return $result->numRows() == 1; } else { if (($this->canShowTestResults($user_id)) && ($this->getShowSolutionPrintview())) { return TRUE; } else { return FALSE; } } return FALSE; }
ilObjTest::canShowTestResults | ( | $ | user_id | ) |
Definition at line 7379 of file class.ilObjTest.php.
References $result, $starting_time, $user_id, canViewResults(), endingTimeReached(), getActiveTestUser(), getStartingTimeOfUser(), getTestType(), isActiveTestSubmitted(), isMaxProcessingTimeReached(), and isTestFinishedToViewResults().
Referenced by canShowSolutionPrintview().
{ $active = $this->getActiveTestUser($user_id); $starting_time = $this->getStartingTimeOfUser($user_id); $notimeleft = FALSE; if ($starting_time !== FALSE) { if ($this->isMaxProcessingTimeReached($starting_time)) { $notimeleft = TRUE; } } $result = TRUE; if (!$this->isTestFinishedToViewResults($active->active_id, $active->tries) && ($this->getScoreReporting() == REPORT_AFTER_TEST)) { $result = FALSE; } if (($this->endingTimeReached()) || $notimeleft) $result = TRUE; $result = $result & $this->canViewResults(); if ($this->getTestType() == TYPE_ONLINE_TEST) { return $result && $this->isActiveTestSubmitted(); } return $result; }
ilObjTest::canViewResults | ( | ) |
Returns true, if the test results can be viewed.
Returns true, if the test results can be viewed
Definition at line 4188 of file class.ilObjTest.php.
References $result, getReportingDate(), and getTestType().
Referenced by canShowTestResults().
{ $result = true; if ($this->getTestType() != TYPE_SELF_ASSESSMENT) { 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; }
ilObjTest::checkMarks | ( | ) |
Definition at line 6031 of file class.ilObjTest.php.
{
return $this->mark_schema->checkMarks();
}
ilObjTest::checkMaximumAllowedUsers | ( | ) |
Definition at line 7826 of file class.ilObjTest.php.
References $query, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), getAllowedUsers(), getAllowedUsersTimeGap(), getTestId(), and logAction().
{ global $ilDB; $nr_of_users = $this->getAllowedUsers(); $time_gap = $this->getAllowedUsersTimeGap(); 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, tst_times.times_id 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; }
ilObjTest::clearEvalSelectedUsers | ( | ) |
Removes all selected users for the test evaluation.
Removes all selected users for the test evaluation
public
Definition at line 2865 of file class.ilObjTest.php.
References $query, and $result.
Referenced by removeAllTestEditings(), and removeSelectedTestResults().
{ global $ilDB; $query = sprintf("DELETE FROM tst_eval_users WHERE test_fi = %s", $ilDB->quote($this->getTestId()) ); $result = $ilDB->query($query); }
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 6095 of file class.ilObjTest.php.
References $query, $result, and $row.
{ 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); } } } }
ilObjTest::create | ( | $ | a_upload = false |
) |
create test object
Definition at line 437 of file class.ilObjTest.php.
References ilObject::create(), and ilObject::createMetaData().
{ parent::create(); // meta data will be created by // import parser if (!$a_upload) { $this->createMetaData(); } }
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 739 of file class.ilObjTest.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{ include_once "./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); } }
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 881 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
{ include_once "./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); } }
ilObjTest::createNewAccessCode | ( | ) |
Returns a new, unused test access code.
Definition at line 7721 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; }
& 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 4984 of file class.ilObjTest.php.
References getQuestionType().
{ if ((!$question_type) and ($question_id > 0)) { $question_type = $this->getQuestionType($question_id); } include_once "./assessment/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; }
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 476 of file class.ilObjTest.php.
References $result, and saveToDb().
{ $result = parent::createReference(); $this->saveToDb(); return $result; }
ilObjTest::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 529 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; }
ilObjTest::deleteActiveTests | ( | ) |
Deletes all active references to this test.
Deletes all active references to this test. This is necessary, if the test has been changed to guarantee the same conditions for all users.
public
Definition at line 3062 of file class.ilObjTest.php.
References $query, and $result.
Referenced by removeAllTestEditings().
{ global $ilDB; $query = sprintf("DELETE FROM tst_active WHERE test_fi = %s", $ilDB->quote($this->getTestId()) ); $result = $ilDB->query($query); }
ilObjTest::deleteResults | ( | $ | user_id = "" |
) |
Removes all question solutions for a given user.
Removes all question solutions for a given user The tst_active table is not affected. Only the existing solutions for all questions the user answered will be removed. This resets the test to the default values
public
Definition at line 3082 of file class.ilObjTest.php.
References $query, $result, $user_id, _getPass(), getActiveTestUser(), and getTestId().
{ global $ilDB; if ($user_id) { $active = $this->getActiveTestUser($user_id); $pass = $this->_getPass($active->active_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_active.user_fi = %s AND tst_solutions.pass = %s", $ilDB->quote($this->getTestId() . ""), $ilDB->quote($user_id . ""), $ilDB->quote($pass . "") ); $result = $ilDB->query($query); $query = sprintf("DELETE FROM tst_test_result WHERE active_fi = %s AND pass = %s", $ilDB->quote($active->active_id . ""), $ilDB->quote($pass . "") ); $result = $ilDB->query($query); $sequence_arr = array_flip($this->questions); $sequence = join($sequence_arr, ","); $query = sprintf("UPDATE tst_active SET sequence = %s, lastindex = %s WHERE test_fi = %s and user_fi = %s", $ilDB->quote($sequence), $ilDB->quote("1"), $ilDB->quote($this->getTestId()), $ilDB->quote($user_id) ); $result = $ilDB->query($query); $query = 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.user_fi = %s", $ilDB->quote($this->getTestId()), $ilDB->quote($user_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 553 of file class.ilObjTest.php.
References $mobs, $query, $result, $row, 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_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 "./classes/class.ilUtil.php"; $tst_data_dir = ilUtil::getDataDir()."/tst_data"; $directory = $tst_data_dir."/tst_".$this->getId(); if (is_dir($directory)) { include_once "./classes/class.ilUtil.php"; ilUtil::delDir($directory); } include_once("./content/classes/Media/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(); } }
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 6888 of file class.ilObjTest.php.
ilObjTest::duplicate | ( | ) |
Duplicates the ilObjTest object.
Duplicates the ilObjTest object
public
Definition at line 980 of file class.ilObjTest.php.
References $counter, $data, $query, $result, and testTitleExists().
{ global $ilDB; $clone = $this; $clone->setId(-1); $counter = 2; while ($this->testTitleExists($this->get_title() . " ($counter)")) { $counter++; } $clone->setTitle($this->get_title() . " ($counter)"); $clone->setOwner($this->ilias->account->id); $clone->setAuthor($this->ilias->account->fullname); $clone->saveToDb($ilDB); // Duplicate questions $query = sprintf("SELECT * FROM tst_test_question WHERE test_fi = %s", $ilDB->quote($this->getId()) ); $result = $ilDB->query($query); while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT)) { $query = sprintf("INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)", $ilDB->quote($clone->getId()), $ilDB->quote($data->question_fi), $ilDB->quote($data->sequence) ); $insert_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 3227 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; }
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 5117 of file class.ilObjTest.php.
References getEndingTime(), and getTestType().
Referenced by canShowTestResults(), and isExecutable().
{ if ($this->getTestType() == TYPE_ASSESSMENT || $this->getTestType() == TYPE_ONLINE_TEST || $this->getTestType() == TYPE_VARYING_RANDOMTEST) { 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; }
ilObjTest::evalLoadStatisticalSettings | ( | $ | user_id | ) |
Retrieves the user settings for the statistical evaluation tool.
Retrieves the user settings for the statistical evaluation tool
Definition at line 4217 of file class.ilObjTest.php.
References $q, $result, and $row.
{ global $ilDB; $q = sprintf("SELECT * FROM tst_eval_settings WHERE user_fi = %s", $ilDB->quote("$user_id") ); $result = $ilDB->query($q); if (!$result->numRows()) { $row = array( "qworkedthrough" => "1", "pworkedthrough" => "1", "timeofwork" => "1", "atimeofwork" => "1", "firstvisit" => "1", "lastvisit" => "1", "resultspoints" => "1", "resultsmarks" => "1", "distancemedian" => "1" ); } else { $row = $result->fetchRow(DB_FETCHMODE_ASSOC); unset($row["eval_settings_id"]); } return $row; }
& 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 8017 of file class.ilObjTest.php.
References _evalResultsOverview(), and getTestId().
{ return $this->_evalResultsOverview($this->getTestId()); }
ilObjTest::evalSaveStatisticalSettings | ( | $ | settings_array, | |
$ | user_id | |||
) |
Saves the user settings for the statistical evaluation tool.
Saves the user settings for the statistical evaluation tool
array | $settings_array An array containing the user settings public |
Definition at line 4255 of file class.ilObjTest.php.
References $q, $result, and $row.
{ global $ilDB; $q = sprintf("SELECT * FROM tst_eval_settings WHERE user_fi = %s", $ilDB->quote("$user_id") ); $result = $ilDB->query($q); if ($result->numRows() > 0) { $row = $result->fetchRow(DB_FETCHMODE_ASSOC); } $update = $row["eval_settings_id"]; if (!$update) { $q = sprintf("INSERT INTO tst_eval_settings ". "(eval_settings_id, user_fi, qworkedthrough, pworkedthrough, timeofwork, atimeofwork, firstvisit, " . "lastvisit, resultspoints, resultsmarks, distancemedian, TIMESTAMP) VALUES " . "(NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)", $ilDB->quote("$user_id"), $ilDB->quote(sprintf("%01d", $settings_array["qworkedthrough"])), $ilDB->quote(sprintf("%01d", $settings_array["pworkedthrough"])), $ilDB->quote(sprintf("%01d", $settings_array["timeofwork"])), $ilDB->quote(sprintf("%01d", $settings_array["atimeofwork"])), $ilDB->quote(sprintf("%01d", $settings_array["firstvisit"])), $ilDB->quote(sprintf("%01d", $settings_array["lastvisit"])), $ilDB->quote(sprintf("%01d", $settings_array["resultspoints"])), $ilDB->quote(sprintf("%01d", $settings_array["resultsmarks"])), $ilDB->quote(sprintf("%01d", $settings_array["distancemedian"])) ); } else { $q = sprintf("UPDATE tst_eval_settings SET ". "qworkedthrough = %s, pworkedthrough = %s, timeofwork = %s, atimeofwork = %s, firstvisit = %s, " . "lastvisit = %s, resultspoints = %s, resultsmarks = %s, distancemedian = %s " . "WHERE eval_settings_id = %s", $ilDB->quote(sprintf("%01d", $settings_array["qworkedthrough"])), $ilDB->quote(sprintf("%01d", $settings_array["pworkedthrough"])), $ilDB->quote(sprintf("%01d", $settings_array["timeofwork"])), $ilDB->quote(sprintf("%01d", $settings_array["atimeofwork"])), $ilDB->quote(sprintf("%01d", $settings_array["firstvisit"])), $ilDB->quote(sprintf("%01d", $settings_array["lastvisit"])), $ilDB->quote(sprintf("%01d", $settings_array["resultspoints"])), $ilDB->quote(sprintf("%01d", $settings_array["resultsmarks"])), $ilDB->quote(sprintf("%01d", $settings_array["distancemedian"])), $ilDB->quote("$update") ); } $result = $ilDB->query($q); }
& 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 4343 of file class.ilObjTest.php.
References $key, $q, $result, $row, _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; }
ilObjTest::evalTotalFinished | ( | ) |
Returns the number of total finished tests.
Returns the number of total finished tests
Definition at line 4592 of file class.ilObjTest.php.
& ilObjTest::evalTotalParticipantsArray | ( | $ | name_sort_order = "asc" |
) |
Returns all participants who started the test.
Returns all participants who started the test
Definition at line 4551 of file class.ilObjTest.php.
References $q, $result, $row, and getTestType().
Referenced by getTotalPointsArray(), and 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 (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"]); } if ($this->getTestType() == TYPE_SELF_ASSESSMENT) { $persons_array[$row["active_id"]] = array("name" => $this->lng->txt("anonymous")); } } } return $persons_array; }
ilObjTest::evalTotalPassedAverageTime | ( | ) |
Returns the average processing time for all passed tests.
Returns the average processing time for all passed tests
Definition at line 4655 of file class.ilObjTest.php.
References $counter, $key, $q, $result, $row, _getPassedUsers(), and ilObject::getId().
{ global $ilDB; include_once "./assessment/classes/class.ilObjTestAccess.php"; $passed_users =& ilObjTest::_getPassedUsers($this->getId()); $q = sprintf("SELECT tst_times.*, tst_active.active_id 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)) { if (in_array($row->active_id, $passed_users)) { 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_id] += ($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::evalTotalPersons | ( | ) |
Returns the number of persons who started the test.
Returns the number of persons who started the test
Definition at line 4168 of file class.ilObjTest.php.
References $q, $result, and $row.
Referenced by canEditMarks().
{ 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; }
& ilObjTest::evalTotalPersonsArray | ( | $ | name_sort_order = "asc" |
) |
Returns all persons who started the test.
Returns all persons who started the test
Definition at line 4510 of file class.ilObjTest.php.
References $q, $result, $row, and getTestType().
{ 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 (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"]); } if ($this->getTestType() == TYPE_SELF_ASSESSMENT) { $persons_array[$row["active_id"]] = $this->lng->txt("anonymous"); } } } return $persons_array; }
ilObjTest::evalTotalStartedAverageTime | ( | ) |
Returns the average processing time for all started tests.
Returns the average processing time for all started tests
Definition at line 4612 of file class.ilObjTest.php.
References $counter, $key, $q, $result, and $row.
{ 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 5916 of file class.ilObjTest.php.
References $file_obj.
Referenced by exportPagesXML().
{ include_once "./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); } }
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 5757 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"); }
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 5898 of file class.ilObjTest.php.
Referenced by exportPagesXML().
{ include_once "./content/classes/Media/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); } }
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 5801 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()); }
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 5835 of file class.ilObjTest.php.
References $file_ids, and $ilBench.
Referenced by exportPagesXML().
{ global $ilBench; include_once "./content/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"); } }
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 5349 of file class.ilObjTest.php.
References $_SESSION, $ilLog, $metadata, ilRTE::_replaceMediaObjectImageSrc(), ilObjMediaObject::_saveTempFileAsMediaObject(), ilObjMediaObject::_saveUsage(), ilObject::getId(), getImportDirectory(), getIntroduction(), QTIMaterialToString(), saveToDb(), setAllowedUsers(), setAllowedUsersTimeGap(), setAuthor(), setCountSystem(), ilObject::setDescription(), setEndingTime(), setHidePreviousResults(), setHideTitlePoints(), setInstantVerification(), setIntroduction(), setMCScoring(), setNrOfTries(), setPassScoring(), setPassword(), setRandomQuestionCount(), setRandomTest(), setReportingDate(), setScoreCutting(), setScoreReporting(), setSequenceSettings(), setShowSolutionDetails(), setShowSolutionPrintview(), setShowSummary(), setShuffleQuestions(), setStartingTime(), setTestType(), and ilObject::setTitle().
{ 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->setInstantVerification(1); break; default: $this->setInstantVerification(0); break; } } foreach ($assessment->qtimetadata as $metadata) { switch ($metadata["label"]) { case "test_type": $this->setTestType($metadata["entry"]); 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": $this->setHidePreviousResults($metadata["entry"]); break; case "hide_title_points": $this->setHideTitlePoints($metadata["entry"]); break; case "random_test": $this->setRandomTest($metadata["entry"]); break; case "random_question_count": $this->setRandomQuestionCount($metadata["entry"]); break; case "show_solution_details": $this->setShowSolutionDetails($metadata["entry"]); break; case "instant_verification": $this->setInstantVerification($metadata["entry"]); break; case "show_solution_printview": $this->setShowSolutionPrintview($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->setShowSummary($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 "./content/classes/Media/class.ilObjMediaObject.php"; include_once "./Services/RTE/classes/class.ilRTE.php"; include_once "./assessment/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(); } }
ilObjTest::generateRandomQuestions | ( | $ | pass = NULL |
) |
Generates new random questions for the active user.
Generates new random questions for the active user
private
Definition at line 1518 of file class.ilObjTest.php.
References $add, $data, $ilErr, ilObject::$ilias, $key, addQuestionSequence(), getActiveTestUser(), getNrOfResultsForPass(), getRandomQuestionCount(), getRandomQuestionpools(), getTestId(), loadQuestions(), randomSelectQuestions(), saveRandomQuestion(), and setActiveTestUser().
{ global $ilUser; $active = $this->getActiveTestUser($ilUser->getId()); $active_id = 0; if (is_object($active)) { $active_id = $active->active_id; $this->loadQuestions($active_id, $pass); if (count($this->questions) > 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 { $active_id = $this->setActiveTestUser(); } if ($active_id == 0) { // 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); } 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; } srand ((float)microtime()*1000000); shuffle($allquestions); foreach ($allquestions as $question_id) { $this->saveRandomQuestion($active_id, $question_id, $pass, $maxcount); } } if (!is_object($active)) { $active = $this->getActiveTestUser($ilUser->getId()); } if (strlen($active->sequence) == 0) { $this->addQuestionSequence($active->active_id); } return; }
& ilObjTest::get_qpl_titles | ( | ) |
Get the titles of all available questionpools for the current user.
Get the titles of all available questionpools for the current user
Definition at line 3347 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, ilObject::_hasUntrashedReference(), and ilObjQuestionPool::_lookupOnline().
{ global $rbacsystem; global $ilDB; $qpl_titles = array(); // get all available questionpools and remove the trashed questionspools $query = "SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.type = 'qpl' ORDER BY object_data.title"; $result = $ilDB->query($query); while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) { if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_hasUntrashedReference($row->obj_id))) { include_once("./assessment/classes/class.ilObjQuestionPool.php"); if (ilObjQuestionPool::_lookupOnline($row->obj_id)) { $qpl_titles["$row->obj_id"] = $row->title; } } } return $qpl_titles; }
ilObjTest::getAccessCodeSession | ( | ) |
Definition at line 7777 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"]; } }
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 3735 of file class.ilObjTest.php.
References $_SESSION, $query, $result, $row, $user_id, and getTestId().
{ 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; } }
ilObjTest::getActiveTestUser | ( | $ | user_id = "" , |
|
$ | anonymous_id = "" | |||
) |
Gets the database row of the tst_active table for the active user.
Gets the database row of the tst_active table for the active user
integer | $user_id The database id of the user |
Definition at line 3677 of file class.ilObjTest.php.
References $_SESSION, $query, $result, $user_id, and getTestId().
Referenced by canShowTestResults(), deleteResults(), generateRandomQuestions(), getAllQuestions(), getAllQuestionsForActiveUser(), getAllTestResults(), getEvaluationParticipants(), getExistingQuestions(), getFirstSequence(), getQuestionIdFromActiveUserSequence(), isExecutable(), loadQuestions(), removeTestResultsForUser(), setActiveTestUser(), setQuestionSetSolved(), and startWorkingTime().
{ global $ilDB; global $ilUser; if (!$user_id) { $user_id = $ilUser->id; } if (($_SESSION["AccountId"] == ANONYMOUS_USER_ID) && (strlen($_SESSION["tst_access_code"][$this->getTestId()]))) { $query = sprintf("SELECT * 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 * 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 * 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()) { $this->active = $result->fetchRow(DB_FETCHMODE_OBJECT); } else { $this->active = null; } return $this->active; }
& ilObjTest::getActiveTestUserFromActiveId | ( | $ | active_id | ) |
Definition at line 3653 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by getQuestions(), getTestResult(), and getTestSummary().
{ global $ilDB; $query = sprintf("SELECT * FROM tst_active WHERE active_id = %s", $ilDB->quote($active_id . "") ); $result = $ilDB->query($query); $row = NULL; if ($result->numRows()) { $row = $result->fetchRow(DB_FETCHMODE_OBJECT); } return $row; }
ilObjTest::getAllowedUsers | ( | ) |
Definition at line 7806 of file class.ilObjTest.php.
Referenced by checkMaximumAllowedUsers(), saveToDb(), and to_xml().
{
return $this->allowedUsers;
}
ilObjTest::getAllowedUsersTimeGap | ( | ) |
Definition at line 7816 of file class.ilObjTest.php.
Referenced by checkMaximumAllowedUsers(), saveToDb(), and to_xml().
{
return $this->allowedUsersTimeGap;
}
& 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 3626 of file class.ilObjTest.php.
References $query, $result, $row, getActiveTestUser(), isRandomTest(), and loadQuestions().
Referenced by getAllQuestionsForActiveUser().
{ global $ilUser; global $ilDB; if ($this->isRandomTest()) { $active = $this->getActiveTestUser($ilUser->getId()); $this->loadQuestions($active->active_id, $pass); $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->active_id . ""), $ilDB->quote($pass . "") ); } else { $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); $result_array = array(); while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $result_array[$row["question_id"]] = $row; } return $result_array; }
& ilObjTest::getAllQuestionsForActiveUser | ( | ) |
Returns all questions of a test in users order.
Returns all questions of a test in users order
Definition at line 3504 of file class.ilObjTest.php.
References getActiveTestUser(), getAllQuestions(), and getWorkedQuestions().
{ $result_array = array(); $active = $this->getActiveTestUser(); $sequence_array = split(",", $active->sequence); $all_questions = &$this->getAllQuestions(); $worked_questions = &$this->getWorkedQuestions($active->active_id); foreach ($sequence_array as $sequence) { if (in_array($this->questions[$sequence], $worked_questions)) { $all_questions[$this->questions[$sequence]]["worked"] = 1; } else { $all_questions[$this->questions[$sequence]]["worked"] = 0; } array_push($result_array, $all_questions[$this->questions[$sequence]]); } return $result_array; }
ilObjTest::getAllTestResults | ( | $ | participants, | |
$ | skip_csv = false | |||
) |
returns all test results for all participants
Definition at line 7041 of file class.ilObjTest.php.
References $results, $row, $user_id, _instanciateQuestion(), getActiveTestUser(), getECTSGrade(), and processCSVRow().
{ $results = array(); $row = array("matriculation" => $this->lng->txt("matriculation"), "lastname" => $this->lng->txt("lastname"), "firstname" => $this->lng->txt("firstname"), "reached_points" => $this->lng->txt("tst_reached_points"), "max_points" => $this->lng->txt("tst_maximum_points"), "percent_value" => $this->lng->txt("tst_percent_solved"), "mark" => $this->lng->txt("tst_mark"), "ects" => $this->lng->txt("ects_grade")); $results[] = $row; foreach ($participants as $user_id => $user_rec) { $row = array(); $active = $this->getActiveTestUser($user_id); $reached_points = 0; $max_points = 0; foreach ($this->questions as $value) { //$value = $this->questions[$seq]; // $ilBench->start("getTestResult","instanciate question"); $question =& ilObjTest::_instanciateQuestion($value); // $ilBench->stop("getTestResult","instanciate question"); if (is_object($question)) { $max_points += $question->getMaximumPoints(); $reached_points += $question->getReachedPoints($active->active_id); } } if ($max_points > 0) { $percentvalue = $reached_points / $max_points; if ($percentvalue < 0) $percentvalue = 0.0; } else { $percentvalue = 0; } $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100); $passed = ""; if ($mark_obj) { $mark = $mark_obj->getOfficialName(); $ects_mark = $this->getECTSGrade($reached_points, $max_points); } $row = array( "matriculation" => $user_rec->matriculation, "lastname" => $user_rec->lastname, "firstname" => $user_rec->firstname, "reached_points" => $reached_points, "max_points" => $max_points, "percent_value" => $percentvalue, "mark" => $mark, "ects" => $ects_mark); $results[] = $skip_csv == true? $row : $this->processCSVRow ($row, true); } return $results; }
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 7267 of file class.ilObjTest.php.
References assQuestion::_isWorkedThrough(), isRandomTest(), and loadQuestions().
{ if ($this->isRandomTest()) { $this->loadQuestions($active_id, $pass); } include_once "./assessment/classes/class.assQuestion.php"; $workedthrough = 0; foreach ($this->questions as $value) { if (assQuestion::_isWorkedThrough($active_id, $value, $pass)) { $workedthrough += 1; } } return $workedthrough; }
& 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 6794 of file class.ilObjTest.php.
References $query, and _getArrayData().
Referenced by getGroupData(), getInvitedUsers(), getRoleData(), and getUserData().
{ return ilObjTest::_getArrayData ($query, $id_field); }
ilObjTest::getAuthor | ( | ) |
Gets the authors name.
Gets the authors name of the ilObjTest object
Definition at line 1948 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->author;
}
& ilObjTest::getAvailableQuestionpoolIDs | ( | ) |
Returns the object id's of the available question pools for the active user.
Returns the object id's of the available question pools for the active user
Definition at line 4703 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, ilObject::_hasUntrashedReference(), and ilObjQuestionPool::_lookupOnline().
Referenced by getQuestionsTable(), and randomSelectQuestions().
{ global $rbacsystem; global $ilDB; $result_array = array(); $query = "SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.type = 'qpl'"; $result = $ilDB->query($query); while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) { if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_hasUntrashedReference($row->obj_id))) { include_once("./assessment/classes/class.ilObjQuestionPool.php"); if (ilObjQuestionPool::_lookupOnline($row->obj_id)) { array_push($result_array, $row->obj_id); } } } return $result_array; }
& ilObjTest::getAvailableQuestionpools | ( | $ | use_object_id = false , |
|
$ | equal_points = false , |
|||
$ | could_be_offline = false , |
|||
$ | with_questioncount = FALSE | |||
) |
Returns the available question pools for the active user.
Returns the available question pools for the active user
Definition at line 4733 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, ilObjQuestionPool::_hasEqualPoints(), ilObject::_hasUntrashedReference(), and ilObjQuestionPool::_lookupOnline().
{ global $rbacsystem; global $ilDB; $result_array = array(); $query = "SELECT object_data.*, object_data.obj_id, object_reference.ref_id, qpl_questionpool.* FROM object_data, object_reference, qpl_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questionpool.obj_fi ORDER BY object_data.title"; $result = $ilDB->query($query); while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) { if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_hasUntrashedReference($row->obj_id))) { include_once("./assessment/classes/class.ilObjQuestionPool.php"); if (ilObjQuestionPool::_lookupOnline($row->obj_id) || $could_be_offline) { if ((!$equal_points) || (($equal_points) && (ilObjQuestionPool::_hasEqualPoints($row->obj_id)))) { $qpl_title = $row->title; if ($with_questioncount) { if ($row->questioncount == 1) { $qpl_title .= " (" . $row->questioncount . " " . $this->lng->txt("ass_question") . ")"; } else { $qpl_title .= " (" . $row->questioncount . " " . $this->lng->txt("assQuestions") . ")"; } } if ($use_object_id) { $result_array[$row->obj_id] = array("title" => $qpl_title, "count" => $row->questioncount); } else { $result_array[$row->ref_id] = array("title" => $qpl_title, "count" => $row->questioncount); } } } } } return $result_array; }
& ilObjTest::getCompleteEvaluationData | ( | $ | withStatistics = TRUE |
) |
Definition at line 8378 of file class.ilObjTest.php.
References $data, $query, $result, $row, buildName(), getCompleteWorkingTimeOfParticipants(), getECTSGrade(), getPassScoring(), getQuestionCount(), getTestId(), getTestType(), getVisitTimeOfParticipant(), and isRandomTest().
{ global $ilDB; include_once "./assessment/classes/class.ilTestEvaluationPassData.php"; include_once "./assessment/classes/class.ilTestEvaluationUserData.php"; include_once "./assessment/classes/class.ilTestEvaluationData.php"; $data = new ilTestEvaluationData($this->getTestId()); $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($this->getTestId() . "") ); $result = $ilDB->query($query); $pass = NULL; $participant = NULL; $pass = NULL; while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { if (!$data->participantExists($row["active_fi"])) { $data->addParticipant($row["active_fi"], new ilTestEvaluationUserData()); $participant =& $data->getParticipant($row["active_fi"]); $participant->setName($this->buildName($row["usr_id"], $row["firstname"], $row["lastname"], $row["title"])); $participant->setLogin($row["login"]); $participant->setUserID($row["usr_id"]); } if (!is_object($participant->getPass($row["pass"]))) { $participant->addPass($row["pass"], new ilTestEvaluationPassData($row["pass"])); $pass =& $participant->getPass($row["pass"]); } $pass->addAnsweredQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["maxpoints"], $row["points"]); } if ($this->getTestType() != TYPE_VARYING_RANDOMTEST) { // ILIAS fix to deal with "old style" tests where a user expects that in a new test pass // the old question answers are part of this pass and only overwritten when a question is answered again foreach ($data->getParticipantIds() as $active_id) { $participant =& $data->getParticipant($active_id); $lastpass = $participant->getLastPass(); if ($lastpass > 0) { $passdatalast =& $participant->getPass($lastpass); $answeredids = array(); foreach ($passdatalast->getAnsweredQuestions() as $foundquestion) { array_push($answeredids, $foundquestion["id"]); } $pointsarray = array(); $reachedarray = array(); for ($pc = 0; $pc <= $lastpass; $pc++) { $passdataactual =& $participant->getPass($pc); if ($passdataactual != null) { foreach ($passdataactual->getAnsweredQuestions() as $foundquestion) { $pointsarray[$foundquestion["id"]] = $foundquestion["points"]; $reachedarray[$foundquestion["id"]] = $foundquestion["reached"]; } } } foreach ($pointsarray as $question_id => $question_points) { if (!in_array($question_id, $answeredids)) { $passdatalast->addAnsweredQuestion($question_id, $question_points, $reachedarray[$question_id]); } } } } } foreach ($data->getParticipantIds() as $active_id) { $participant =& $data->getParticipant($active_id); if ($this->isRandomTest()) { for ($testpass = 0; $testpass <= $data->getLastPassOfParticipant($active_id); $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, qpl_question_type.type_tag " . "FROM tst_test_random_question, qpl_questions, qpl_question_type " . "WHERE tst_test_random_question.question_fi = qpl_questions.question_id " . "AND tst_test_random_question.pass = %s " . "AND qpl_questions.question_type_fi = qpl_question_type.question_type_id " . "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)) { $rpass = array_key_exists("pass", $row) ? $row["pass"] : 0; $data->addQuestionForParticipant($active_id, $row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $rpass, $row["type_tag"], $row["question_fi"]); $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, qpl_question_type.type_tag " . "FROM tst_test_question, tst_active, qpl_questions, qpl_question_type " . "WHERE tst_test_question.question_fi = qpl_questions.question_id " . "AND qpl_questions.question_type_fi = qpl_question_type.question_type_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()) { while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $rpass = array_key_exists("pass", $row) ? $row["pass"] : 0; $participant->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["points"], $row["sequence"], $rpass, $row["type_tag"], $row["question_fi"]); $data->addQuestionTitle($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["title"]); } } } } $workingTimes =& $this->getCompleteWorkingTimeOfParticipants(); foreach (array_keys($data->getParticipants()) as $active_id) { $xpass = 0; $participant =& $data->getParticipant($active_id); if ($this->getPassScoring() == SCORE_BEST_PASS) { $xpass = $participant->getBestPass(); } else { $xpass = $participant->getLastPass(); } $participant->setReached($participant->getReachedPoints($xpass)); $participant->setMaxPoints($participant->getAvailablePoints($xpass)); $percentage = $participant->getMaxPoints() ? $participant->getReached() / $participant->getMaxPoints() * 100.0 : 0; $mark = $this->mark_schema->getMatchingMark($percentage); if (is_object($mark)) { $participant->setMark($mark->getShortName()); $participant->setMarkOfficial($mark->getOfficialName()); $participant->setPassed($mark->getPassed()); } if ($this->ects_output) { // TODO: This is a performance killer!!!! $ects_mark = $this->getECTSGrade($participant->getReached(), $participant->getMaxPoints()); $participant->setECTSMark($ects_mark); } $userpass =& $participant->getPass($xpass); if (is_object($userpass)) $participant->setQuestionsWorkedThrough($userpass->getAnsweredQuestionCount()); $questionpass = $xpass; if (!is_array($participant->getQuestions($xpass))) { $questionpass = 0; } $participant->setNumberOfQuestions(count($participant->getQuestions($questionpass))); $participant->setTimeOfWork($workingTimes[$active_id]); $visitingTime =& $this->getVisitTimeOfParticipant($active_id); $participant->setFirstVisit($visitingTime["firstvisit"]); $participant->setLastVisit($visitingTime["lastvisit"]); } if ($withStatistics) { $data->calculateStatistics(); } return $data; }
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 4314 of file class.ilObjTest.php.
References $q, $result, $row, and $user_id.
{ 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::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 8569 of file class.ilObjTest.php.
References _getCompleteWorkingTimeOfParticipants(), and getTestId().
Referenced by getCompleteEvaluationData().
{ return $this->_getCompleteWorkingTimeOfParticipants($this->getTestId()); }
ilObjTest::getCountSystem | ( | ) |
Gets the count system for the calculation of points.
Gets the count system for the calculation of points
Definition at line 2174 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->count_system;
}
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 5955 of file class.ilObjTest.php.
References _getECTSGrade(), and getTotalPointsPassedArray().
Referenced by getAllTestResults(), and getCompleteEvaluationData().
{ $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); }
ilObjTest::getEnableProcessingTime | ( | ) |
Returns the state of the processing time (enabled/disabled).
Returns the state of the processing time (enabled/disabled)
Definition at line 2608 of file class.ilObjTest.php.
Referenced by isExecutable(), and isMaxProcessingTimeReached().
{
return $this->enable_processing_time;
}
ilObjTest::getEndingTime | ( | ) |
Returns the ending time of the test.
Returns the ending time of the test
Definition at line 2636 of file class.ilObjTest.php.
Referenced by endingTimeReached(), getSecondsUntilEndingTime(), isExecutable(), and to_xml().
{
return $this->ending_time;
}
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 4785 of file class.ilObjTest.php.
References $result, and _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; }
& ilObjTest::getEvaluationParticipants | ( | $ | user_id, | |
$ | sort_name_option = "asc" | |||
) |
Returns an array of users who are selected for a test evaluation of a given user.
Returns an array of users who are selected for a test evaluation of a given user
public
Definition at line 6256 of file class.ilObjTest.php.
References $query, $result, $row, $user_id, $users, getActiveTestUser(), and getTestType().
{ global $ilDB; $users = array(); $query = sprintf("SELECT tst_eval_users.user_fi, usr_data.firstname, usr_data.lastname FROM tst_eval_users, usr_data WHERE tst_eval_users.test_fi = %s AND tst_eval_users.evaluator_fi = %s AND tst_eval_users.user_fi = usr_data.usr_id ORDER BY usr_data.lastname " . strtoupper($sort_name_option), $ilDB->quote($this->getTestId() . ""), $ilDB->quote($user_id . "") ); $result = $ilDB->query($query); if ($result->numRows()) { while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $active = $this->getActiveTestUser($row["user_fi"]); if (is_object($active)) { $name = trim($row["lastname"] . ", " . $row["firstname"] ." " . $row["title"]); if ($this->getTestType() == TYPE_SELF_ASSESSMENT) { $name = $this->lng->txt("anonymous"); } $users[$active->active_id] = $name; } } } return $users; }
& ilObjTest::getEvaluationUsers | ( | $ | user_id, | |
$ | sort_name_option = "asc" | |||
) |
Returns an array of users who are selected for a test evaluation of a given user.
Returns an array of users who are selected for a test evaluation of a given user
public
Definition at line 6224 of file class.ilObjTest.php.
References $query, $result, $row, $user_id, $users, and getTestType().
{ global $ilDB; $users = array(); $query = sprintf("SELECT tst_eval_users.user_fi, usr_data.firstname, usr_data.lastname FROM tst_eval_users, usr_data WHERE tst_eval_users.test_fi = %s AND tst_eval_users.evaluator_fi = %s AND tst_eval_users.user_fi = usr_data.usr_id ORDER BY usr_data.lastname " . strtoupper($sort_name_option), $ilDB->quote($this->getTestId() . ""), $ilDB->quote($user_id . "") ); $result = $ilDB->query($query); if ($result->numRows()) { while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $name = trim($row["lastname"] . ", " . $row["firstname"] ." " . $row["title"]); if ($this->getTestType() == TYPE_SELF_ASSESSMENT) { $name = $this->lng->txt("anonymous"); } $users[$row["user_fi"]] = $name; } } return $users; }
& 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 3378 of file class.ilObjTest.php.
References $data, $query, $result, getActiveTestUser(), and isRandomTest().
{ global $ilUser; global $ilDB; $existing_questions = array(); $active = $this->getActiveTestUser($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->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; }
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 773 of file class.ilObjTest.php.
References ilUtil::getDataDir().
{ include_once "./classes/class.ilUtil.php"; $export_dir = ilUtil::getDataDir()."/tst_data"."/tst_".$this->getId()."/export"; return $export_dir; }
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 788 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::getFirstSequence | ( | ) |
Definition at line 3526 of file class.ilObjTest.php.
References $result, $results, getActiveTestUser(), getQuestionCount(), getQuestionIdFromActiveUserSequence(), and getTestResult().
{ global $ilUser; $active = $this->getActiveTestUser($ilUser->getId()); $results = $this->getTestResult($active->active_id); for($i = 1; $i <= $this->getQuestionCount(); $i++) { $qid = $this->getQuestionIdFromActiveUserSequence($i); foreach($results as $result) { if($qid == $result['qid']) { if(!$result['max'] or $result['max'] != $result['reached']) { return $i; } } } } return 0; }
& ilObjTest::getGroupData | ( | $ | ids | ) |
Definition at line 6810 of file class.ilObjTest.php.
References $query, and 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"); }
ilObjTest::getHidePreviousResults | ( | ) |
Returns if the previous results should be hidden for a learner.
Returns if the previous results should be hidden for a learner
Definition at line 2453 of file class.ilObjTest.php.
Referenced by saveToDb(), and to_xml().
{
return $this->hide_previous_results;
}
ilObjTest::getHideTitlePoints | ( | ) |
Returns true if the maximum points of a question should be hidden in the question title.
Returns true if the maximum points of a question should be hidden in the question title
Definition at line 2467 of file class.ilObjTest.php.
Referenced by saveToDb(), and to_xml().
{
return $this->hide_title_points;
}
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 4954 of file class.ilObjTest.php.
References ilObject::getId().
Referenced by getQuestionsTable().
{ return CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/images/"; }
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 4967 of file class.ilObjTest.php.
References ilObject::getId(), and ilUtil::removeTrailingPathSeparators().
{ include_once "./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); }
ilObjTest::getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 910 of file class.ilObjTest.php.
References ilUtil::getDataDir().
Referenced by fromXML().
{ include_once "./classes/class.ilUtil.php"; $import_dir = ilUtil::getDataDir()."/tst_data/tst_import"; if(@is_dir($import_dir)) { return $import_dir; } else { return false; } }
ilObjTest::getImportMapping | ( | ) |
get array of (two) new created questions for import id
Definition at line 5933 of file class.ilObjTest.php.
{ if (!is_array($this->import_mapping)) { return array(); } else { return $this->import_mapping; } }
ilObjTest::getInstantVerification | ( | ) |
Gets the instant verification.
Gets the instant verification of the ilObjTest object
Definition at line 2160 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->instant_verification;
}
ilObjTest::getIntroduction | ( | ) |
Gets the introduction.
Gets the introduction text of the ilObjTest object
Definition at line 1990 of file class.ilObjTest.php.
Referenced by fromXML(), and to_xml().
{
return $this->introduction;
}
& 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 6707 of file class.ilObjTest.php.
References $query, $user_id, and getArrayData().
{ global $ilDB; $result_array = array(); if (is_numeric($user_id)) { $query = sprintf("SELECT 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 ); /* CREATED NEW VERSION FOR MYSQL 5 COMPATIBILITY (Helmut Schottmüller, 2006-09-18) $query = sprintf("SELECT usr_id, login, lastname, firstname, t.clientip, test.submitted as test_finished, matriculation, IF(test.active_id IS NULL,0,1) as test_started " . "FROM tst_invited_user t, usr_data ". "LEFT JOIN tst_active test ON test.user_fi=usr_id AND test.test_fi=t.test_fi ". "WHERE t.test_fi = %s and t.user_fi=usr_id AND usr_id=%s ". "ORDER BY %s", $ilDB->quote($this->test_id), $user_id, $order );*/ } else { $query = sprintf("SELECT 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 ); /* CREATED NEW VERSION FOR MYSQL 5 COMPATIBILITY (Helmut Schottmüller, 2006-09-18) $query = sprintf("SELECT usr_id, login, lastname, firstname, t.clientip, test.submitted as test_finished, matriculation, IF(test.active_id IS NULL,0,1) as test_started " . "FROM tst_invited_user t, usr_data ". "LEFT JOIN tst_active test ON test.user_fi=usr_id AND test.test_fi=t.test_fi ". "WHERE t.test_fi = %s and t.user_fi=usr_id ". "ORDER BY %s", $ilDB->quote($this->test_id), $order );*/ } return $this->getArrayData($query, "usr_id"); }
ilObjTest::getMCScoring | ( | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 2212 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->mc_scoring;
}
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 1498 of file class.ilObjTest.php.
References $query, and $result.
Referenced by generateRandomQuestions(), and setActiveTestUser().
{ 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(); }
ilObjTest::getNrOfTries | ( | ) |
Returns the nr of tries for the test.
Returns the nr of tries for the test
Definition at line 2439 of file class.ilObjTest.php.
Referenced by hasNrOfTriesRestriction(), isNrOfTriesReached(), and to_xml().
{
return $this->nr_of_tries;
}
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 7296 of file class.ilObjTest.php.
References $query, $result, and $row.
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; } }
ilObjTest::getPassScoring | ( | ) |
Gets the pass scoring type.
Gets the pass scoring type
Definition at line 2254 of file class.ilObjTest.php.
Referenced by getCompleteEvaluationData(), saveToDb(), and to_xml().
{
return $this->pass_scoring;
}
ilObjTest::getPassword | ( | ) |
Returns the password for test access.
Returns the password for test access
Definition at line 2240 of file class.ilObjTest.php.
Referenced by saveToDb(), and to_xml().
{
return $this->password;
}
ilObjTest::getProcessingTime | ( | ) |
Returns the processing time for the test.
Returns the processing time for the test
Definition at line 2550 of file class.ilObjTest.php.
Referenced by getProcessingTimeInSeconds().
{
return $this->processing_time;
}
ilObjTest::getProcessingTimeInSeconds | ( | ) |
Returns the processing time for the test in seconds.
Returns the processing time for the test in seconds
Definition at line 2564 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; } }
ilObjTest::getQuestionCount | ( | ) |
Returns the number of questions in the test.
Returns the number of questions in the test
Definition at line 6378 of file class.ilObjTest.php.
References $add, $data, getRandomQuestionCount(), getRandomQuestionpools(), and isRandomTest().
Referenced by addQuestionSequence(), getCompleteEvaluationData(), and getFirstSequence().
{ $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; }
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 3327 of file class.ilObjTest.php.
References $query, $result, and $row.
{ 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::getQuestionIdFromActiveUserSequence | ( | $ | sequence | ) |
Calculate the question id from a test sequence number.
Calculate the question id from a test sequence number
integer | $sequence The sequence number of the question |
Definition at line 3487 of file class.ilObjTest.php.
References getActiveTestUser().
Referenced by getFirstSequence().
{ global $ilUser; $active = $this->getActiveTestUser(); $sequence_array = split(",", $active->sequence); return $this->questions[$sequence_array[$sequence-1]]; }
& ilObjTest::getQuestions | ( | $ | active_id = "" , |
|
$ | pass = NULL , |
|||
$ | userorder = FALSE | |||
) |
Returns the the question ids of the test.
Returns the the question ids of the test. This could be done for the active user as well as for the test object itself. It is also possible to sort the questions in the sequence the user worked through the test
integer | $active_id The active id of the user | |
integer | $pass The pass that should be examined | |
boolean | $userorder TRUE if the question ids should be returned in the sequence the user worked through the questions during the test public |
Definition at line 1886 of file class.ilObjTest.php.
References getActiveTestUserFromActiveId(), isRandomTest(), and loadQuestions().
{ if ($active_id > 0) { if ($this->isRandomTest()) { $this->loadQuestions($active_id, $pass); } if ($userorder) { $result_array = array(); $active =& $this->getActiveTestUserFromActiveId($active_id); $sequence_array = split(",", $active->sequence); $index = 1; foreach ($sequence_array as $sequence) { $result_array[$index] = $this->questions[$sequence]; $index++; } return $result_array; } } return $this->questions; }
ilObjTest::getQuestionsTable | ( | $ | sort, | |
$ | sortorder, | |||
$ | filter_text, | |||
$ | sel_filter_type, | |||
$ | 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 5145 of file class.ilObjTest.php.
References $query, $result, $row, getAvailableQuestionpoolIDs(), and getImagePath().
{ global $ilUser; global $ilDB; $where = ""; 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;