Inheritance diagram for ilObjTest:
Collaboration diagram for ilObjTest:Public Member Functions | |
| ilObjTest ($a_id=0, $a_call_by_reference=true) | |
| Constructor public. | |
| create ($a_upload=false) | |
| create test object | |
| update () | |
| update object data | |
| createReference () | |
| Creates a database reference id for the object. | |
| getCallingScript () | |
| Returns the calling script of the class. | |
| 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 ($question_id) | |
| Saves a random question to the database. | |
| 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 ($user_id="") | |
| Load the test question id's from the database. | |
| 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. | |
| 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. | |
| getCountSystem () | |
| Gets the count system for the calculation of points. | |
| _getCountSystem ($test_id) | |
| Gets the count system for the calculation of points. | |
| getMCScoring () | |
| Gets the scoring type for multiple choice questions. | |
| _getMCScoring ($test_id) | |
| Gets the scoring type for multiple choice questions. | |
| getTestType () | |
| Gets the test type. | |
| getReportingDate () | |
| Gets the reporting date. | |
| getNrOfTries () | |
| Returns the nr of tries for the test. | |
| getProcessingTime () | |
| Returns the processing time for the test. | |
| getProcessingTimeInSeconds () | |
| Returns the processing time for the test in seconds. | |
| 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. | |
| 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. | |
| setMCScoring ($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED) | |
| Sets the multiple choice scoring. | |
| removeQuestion ($question_id) | |
| Removes a question from the test object. | |
| clearEvalSelectedUsers () | |
| Removes all selected users for the test evaluation. | |
| clearEvalSelectedGroups () | |
| Removes all selected groups for the test evaluation. | |
| removeAllTestEditings ($question_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="", $a_delete_active=false) | |
| 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. | |
| getQuestionTitle ($sequence) | |
| Returns the title of a question with a given sequence number. | |
| 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 () |
| 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. | |
| getWrongAnsweredQuestions () | |
| incrementSequenceByResult ($a_sequence) | |
| increments sequence to the next wrong answered question | |
| decrementSequenceByResult ($a_sequence) | |
| decrements sequence to the next wrong answered question | |
| getFirstSequence () | |
| & | getWorkedQuestions () |
| Gets the id's of all questions a user already worked through. | |
| & | getAllQuestions () |
| Returns all questions of a test in test order. | |
| getActiveTestUser ($user_id="") | |
| Gets the database row of the tst_active table for the active 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. | |
| & | getTestResult ($user_id) |
| Calculates the results of a test for a given user. | |
| & | getTestSummary ($user_id) |
| Calculates the overview of a test for a given user. | |
| & | _getTestResult ($user_id, $test_obj_id) |
| Calculates the results of a test for a given user. | |
| evalTotalPersons () | |
| Returns a result for a condition check on the class. | |
| 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 ($user_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 () |
| Returns all persons who started the test. | |
| evalTotalFinished () | |
| Returns the number of total finished tests. | |
| evalTotalFinishedPassed () | |
| Returns the total passed tests and the average reached points. | |
| evalTotalFinishedAverageTime () | |
| Returns the average processing time for total finished tests. | |
| & | getAvailableQuestionpoolIDs () |
| Returns the object id's of the available question pools for the active user. | |
| & | getAvailableQuestionpools ($use_object_id=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="") | |
| 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 ($sortoptions, $filter_text, $sel_filter_type, $startrow=0, $completeonly=0, $filter_question_type="", $filter_questionpool="") | |
| Calculates the data for the output of the questionpool. | |
| _getTestType ($test_id) | |
| Returns the test type for a given test id. | |
| & | _getQuestiontypes () |
| Creates a list of all available question types. | |
| 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 | |
| from_xml ($xml_text) | |
| Imports the test properties from XML into the test object. | |
| importObject ($source, $questionpool_id) | |
| Imports a test from XML into the ILIAS database. | |
| 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. | |
| checkMarks () | |
| updateMetaData () | |
| update meta data entry | |
| & | _getAvailableTests ($use_object_id=false) |
| Returns the available question pools 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) | |
| createRandomSolutionsForAllUsers () | |
| & | getEvaluationUsers ($user_id) |
| Returns an array of users who are selected for a test evaluation of a given user. | |
| & | getEvaluationGroups ($user_id) |
| Returns an array of groups 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. | |
| removeSelectedGroup ($group_id, $evaluator_id) | |
| Disinvites a group from a evaluation. | |
| addSelectedGroup ($group_id, $evaluator_id) | |
| Invites a group to a evaluation. | |
| getQuestionCount () | |
| Returns the number of questions in the test. | |
| _goto ($a_target) | |
| Redirect script to call a test with the test reference id. | |
| 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. | |
| _getTestIDFromObjectID ($object_id) | |
| Returns the ILIAS test id for a given object id. | |
| getTextAnswer ($user_id, $question_id) | |
| 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) | |
| & | getAllSolutionValues () |
| Gets the. | |
| isOnlineTest () | |
| gets TestType equals Online Test | |
| _getSolvedQuestions ($test_fi, $user_fi, $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 () | |
| returns all test results for all participants | |
| & | processCSVRow ($row, $quoteAll=FALSE, $separator=";") |
| Convertes an array for CSV usage. | |
| 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. | |
Data Fields | |
| $test_id | |
| $invitation = INVITATION_OFF | |
| $author | |
| $metadata | |
| $questions | |
| $introduction | |
| $mark_schema | |
| $sequence_settings | |
| $score_reporting | |
| $reporting_date | |
| $evaluation_data | |
| $test_type | |
| $nr_of_tries | |
| $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 | |
Definition at line 69 of file class.ilObjTest.php.
| 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 5183 of file class.ilObjTest.php.
References $_GET, $counter, $obj_id, ASS_Question::_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->setTitle($original->getTitle() . " ($counter)");
$newObj->setDescription($original->getDescription());
$newObj->create(true);
$newObj->createReference();
$newObj->putInTree($_GET["ref_id"]);
$newObj->setPermissions($_GET["ref_id"]);
// $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
$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->reporting_date = $original->getReportingDate();
$newObj->test_type = $original->getTestType();
$newObj->nr_of_tries = $original->getNrOfTries();
$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
foreach ($original->questions as $key => $question_id)
{
$question = ilObjTest::_instanciateQuestion($question_id);
$newObj->questions[$key] = $question->duplicate();
// $question->id = -1;
$original_id = ASS_Question::_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());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_createImportDirectory | ( | ) |
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directory that is set in ILIAS setup/ini)
Definition at line 755 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
Referenced by ilObjTestGUI::uploadTstObject().
{
global $ilias;
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$ilias->raiseError("Test data directory (".$tst_data_dir
.") not writeable.",$ilias->error_obj->FATAL);
}
// create test directory (data_dir/tst_data/tst_import)
$tst_dir = $tst_data_dir."/tst_import";
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$ilias->raiseError("Creation of test import directory failed.",$ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_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 2791 of file class.ilObjTest.php.
References $ilUser, $query, $result, $test_id, and $user_id.
{
global $ilDB;
global $ilUser;
$db =& $ilDB->db;
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",
$db->quote($user_id),
$db->quote($test_id)
);
$result = $db->query($query);
if ($result->numRows()) {
return $result->fetchRow(DB_FETCHMODE_OBJECT);
} else {
return "";
}
}
| & ilObjTest::_getArrayData | ( | $ | query, | |
| $ | id_field | |||
| ) |
Definition at line 5756 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();
}
Here is the caller graph for this function:| & ilObjTest::_getAvailableTests | ( | $ | use_object_id = false |
) |
Returns the available question pools for the active user.
Returns the available question pools for the active user
Definition at line 5119 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);
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;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getCountSystem | ( | $ | test_id | ) |
Gets the count system for the calculation of points.
Gets the count system for the calculation of points
Definition at line 1715 of file class.ilObjTest.php.
References $query, $result, $row, and $test_id.
Referenced by ASS_Question::getSolutionCommentCountSystem().
{
global $ilDB;
$query = sprintf("SELECT count_system FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["count_system"];
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::_getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 785 of file class.ilObjTest.php.
References ilUtil::getDataDir().
Referenced by ilObjTestGUI::importVerifiedFileObject(), and ilObjTestGUI::uploadTstObject().
{
$import_dir = ilUtil::getDataDir()."/tst_data/tst_import";
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getMCScoring | ( | $ | test_id | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 1753 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by ASS_Question::getSolutionCommentMCScoring().
{
global $ilDB;
$query = sprintf("SELECT mc_scoring FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_Id)
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["mc_scoring"];
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::_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 5583 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;
}
Here is the caller graph for this function:| & ilObjTest::_getQuestiontypes | ( | ) |
Creates a list of all available question types.
Creates a list of all available question types
Definition at line 4263 of file class.ilObjTest.php.
| ilObjTest::_getRefIdFromObjId | ( | $ | obj_id | ) |
Definition at line 5250 of file class.ilObjTest.php.
| ilObjTest::_getSolvedQuestions | ( | $ | test_fi, | |
| $ | user_fi, | |||
| $ | question_fi = null | |||
| ) |
get solved questions
Definition at line 5924 of file class.ilObjTest.php.
References $query, and _getArrayData().
Referenced by getTestSummary(), and ilObjTestGUI::outWorkingForm().
{
global $ilDB;
if (is_numeric($question_fi))
$query = sprintf("SELECT question_fi, solved FROM tst_active_qst_sol_settings " .
"WHERE user_fi = %s AND test_fi = %s AND question_fi=%s",
$ilDB->quote($user_fi),
$ilDB->quote($test_fi),
$question_fi
);
else $query = sprintf("SELECT question_fi, solved FROM tst_active_qst_sol_settings " .
"WHERE user_fi = %s AND test_fi = %s",
$ilDB->quote($user_fi),
$ilDB->quote($test_fi)
);
return ilObjTest::_getArrayData ($query, "question_fi");
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_getTestIDFromObjectID | ( | $ | object_id | ) |
Returns the ILIAS test id for a given object id.
Returns the ILIAS test id for a given object id
| integer | $object_id The object id |
Definition at line 5608 of file class.ilObjTest.php.
References $query, $result, $row, and $test_id.
Referenced by ilObjAssessmentFolder::getLog().
{
global $ilDB;
$test_id = FALSE;
$query = sprintf("SELECT test_id FROM tst_tests WHERE obj_fi = %s",
$ilDB->quote($object_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$test_id = $row["test_id"];
}
return $test_id;
}
Here is the caller graph for this function:| & ilObjTest::_getTestResult | ( | $ | user_id, | |
| $ | test_obj_id | |||
| ) |
Calculates the results of a test for a given user.
Calculates the results of a test for a given user and returns an array with all test results
Definition at line 3041 of file class.ilObjTest.php.
References $result, $user_id, and ilObjTest().
{
$test = new ilObjTest($test_obj_id, false);
$test->loadFromDb();
$result =& $test->getTestResult($user_id);
return $result;
}
Here is the call graph for this function:| ilObjTest::_getTestType | ( | $ | test_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 4238 of file class.ilObjTest.php.
References $query, $result, $row, and $test_id.
Referenced by ASS_JavaApplet::to_xml().
{
global $ilDB;
$result = "";
$query = sprintf("SELECT tst_test_type.type_tag FROM tst_test_type, tst_tests WHERE tst_test_type.test_type_id = tst_tests.test_type_fi AND tst_tests.test_id = %s",
$ilDB->quote($test_id)
);
$query_result = $ilDB->query($query);
if ($query_result->numRows())
{
$row = $query_result->fetchRow(DB_FETCHMODE_ASSOC);
$result = $row["type_tag"];
}
return $result;
}
Here is the caller graph for this function:| ilObjTest::_goto | ( | $ | a_target | ) |
Redirect script to call a test with the test reference id.
Redirect script to call a test with the test reference id
| integer | $a_target The reference id of the test public |
Definition at line 5496 of file class.ilObjTest.php.
References $ilErr, ilObject::$lng, $rbacsystem, ilSearch::_checkParentConditions(), and ilUtil::redirect().
{
global $rbacsystem, $ilErr, $lng;
include_once 'classes/class.ilSearch.php';
// Added this additional check (ParentConditions) to avoid calls of objects inside e.g courses.
// Will be replaced in future releases by ilAccess::checkAccess()
if ($rbacsystem->checkAccess("read", $a_target) and ilSearch::_checkParentConditions($a_target))
{
ilUtil::redirect("assessment/test.php?cmd=run&ref_id=$a_target");
}
else
{
$ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
}
}
Here is the call graph for this function:| & ilObjTest::_instanciateQuestion | ( | $ | question_id | ) |
Creates an instance of a question with a given question id.
Creates an instance of a question with a given question id
| integer | $question_id The question id |
Definition at line 3930 of file class.ilObjTest.php.
References ASS_Question::_getQuestionType().
Referenced by ilCourseObjectiveQuestion::__read(), _clone(), ilCourseObjectivesGUI::askDeassignQuestion(), ilCourseObjectivesGUI::assignQuestionSelect(), createRandomSolutionsForAllUsers(), duplicateQuestionForTest(), getAllTestResults(), getEstimatedWorkingTime(), ilCourseObjectiveQuestion::getMaxPointsByObjective(), ilCourseObjectiveQuestion::getMaxPointsByTest(), getTestSummary(), ilCourseObjectivesGUI::listAssignedQuestions(), and to_xml().
{
if (strcmp($question_id, "") != 0)
{
$question_type = ASS_Question::_getQuestionType($question_id);
switch ($question_type) {
case "qt_cloze":
$question = new ASS_ClozeTest();
break;
case "qt_matching":
$question = new ASS_MatchingQuestion();
break;
case "qt_ordering":
$question = new ASS_OrderingQuestion();
break;
case "qt_imagemap":
$question = new ASS_ImagemapQuestion();
break;
case "qt_multiple_choice_sr":
case "qt_multiple_choice_mr":
$question = new ASS_MultipleChoice();
break;
case "qt_javaapplet":
$question = new ASS_JavaApplet();
break;
case "qt_text":
$question = new ASS_TextQuestion();
break;
default:
// Return false if question id does not exists or type is unknown
return false;
}
$question->loadFromDb($question_id);
return $question;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::_isComplete | ( | $ | obj_id | ) |
Returns true, if a test is complete for use.
Returns true, if a test is complete for use
Definition at line 970 of file class.ilObjTest.php.
References $obj_id, and ilObjTest().
Here is the call graph for this function:| 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 5435 of file class.ilObjTest.php.
References $query, and $result.
{
$query = sprintf("SELECT group_fi FROM tst_eval_groups WHERE test_fi = %s AND evaluator_fi = %s AND group_fi = %s",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($evaluator_id . ""),
$this->ilias->db->quote($group_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows() < 1)
{
$query = sprintf("INSERT INTO tst_eval_groups (eval_groups_id, test_fi, evaluator_fi, group_fi, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($evaluator_id . ""),
$this->ilias->db->quote($group_id . "")
);
$result = $this->ilias->db->query($query);
}
}
| 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 5390 of file class.ilObjTest.php.
References $query, $result, and $user_id.
{
$query = sprintf("SELECT user_fi FROM tst_eval_users WHERE test_fi = %s AND evaluator_fi = %s AND user_fi = %s",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($evaluator_id . ""),
$this->ilias->db->quote($user_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows() < 1)
{
$query = sprintf("INSERT INTO tst_eval_users (eval_users_id, test_fi, evaluator_fi, user_fi, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($evaluator_id . ""),
$this->ilias->db->quote($user_id . "")
);
$result = $this->ilias->db->query($query);
}
}
| ilObjTest::canViewResults | ( | ) |
Returns true, if the test results can be viewed.
Returns true, if the test results can be viewed
Definition at line 3167 of file class.ilObjTest.php.
References $result, getReportingDate(), and getTestType().
{
$result = true;
if ($this->getTestType() == TYPE_ASSESSMENT || $this->getTestType() == TYPE_ONLINE_TEST)
{
if ($this->getReportingDate())
{
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getReportingDate(), $matches);
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
$result = false;
}
}
}
return $result;
}
Here is the call graph for this function:| ilObjTest::checkMarks | ( | ) |
Definition at line 5089 of file class.ilObjTest.php.
{
return $this->mark_schema->checkMarks();
}
| ilObjTest::clearEvalSelectedGroups | ( | ) |
Removes all selected groups for the test evaluation.
Removes all selected groups for the test evaluation
public
Definition at line 2034 of file class.ilObjTest.php.
References $query, and $result.
Referenced by removeAllTestEditings().
{
$query = sprintf("DELETE FROM tst_eval_groups WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
}
Here is the caller graph for this function:| ilObjTest::clearEvalSelectedUsers | ( | ) |
Removes all selected users for the test evaluation.
Removes all selected users for the test evaluation
public
Definition at line 2019 of file class.ilObjTest.php.
References $query, and $result.
Referenced by removeAllTestEditings().
{
$query = sprintf("DELETE FROM tst_eval_users WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
}
Here is the caller graph for this function:| ilObjTest::cloneRandomQuestions | ( | $ | new_id | ) |
Duplicates the source random questionpools for another test.
Duplicates the source random questionpools for another test
| integer | $new_id Test id of the new test which should take the random questionpools public |
Definition at line 5152 of file class.ilObjTest.php.
References $query, $result, and $row.
{
if ($new_id > 0)
{
$query = sprintf("SELECT * FROM tst_test_random WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId() . "")
);
$result = $this->ilias->db->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)",
$this->ilias->db->quote($new_id . ""),
$this->ilias->db->quote($row["questionpool_fi"] . ""),
$this->ilias->db->quote($row["num_of_q"] . "")
);
$insertresult = $this->ilias->db->query($query);
}
}
}
}
| ilObjTest::create | ( | $ | a_upload = false |
) |
create test object
Definition at line 366 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();
}
}
Here is the call graph for this function:| ilObjTest::createExportDirectory | ( | ) |
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directory that is set in ILIAS setup/ini)
Definition at line 664 of file class.ilObjTest.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$this->ilias->raiseError("Test Data Directory (".$tst_data_dir
.") not writeable.",$this->ilias->error_obj->MESSAGE);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$tst_dir = $tst_data_dir."/tst_".$this->getId();
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$this->ilias->raiseError("Creation of Test Directory failed.",$this->ilias->error_obj->MESSAGE);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
$export_dir = $tst_dir."/export";
ilUtil::makeDir($export_dir);
if(!@is_dir($export_dir))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->MESSAGE);
}
}
Here is the call graph for this function:| ilObjTest::createImportDirectory | ( | ) |
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directory that is set in ILIAS setup/ini)
Definition at line 803 of file class.ilObjTest.php.
References ilObject::$ilias, ilUtil::getDataDir(), and ilUtil::makeDir().
{
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
ilUtil::makeDir($tst_data_dir);
if(!is_writable($tst_data_dir))
{
$this->ilias->raiseError("Test Data Directory (".$tst_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create test directory (data_dir/tst_data/tst_import)
$tst_dir = $tst_data_dir."/tst_import";
ilUtil::makeDir($tst_dir);
if(!@is_dir($tst_dir))
{
$ilias->raiseError("Creation of test import directory failed.",$ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:| & ilObjTest::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 3879 of file class.ilObjTest.php.
References getQuestionType().
{
if ((!$question_type) and ($question_id > 0))
{
$question_type = $this->getQuestionType($question_id);
}
switch ($question_type)
{
case "qt_multiple_choice_sr":
$question =& new ASS_MultipleChoiceGUI();
$question->object->set_response(RESPONSE_SINGLE);
break;
case "qt_multiple_choice_mr":
$question =& new ASS_MultipleChoiceGUI();
$question->object->set_response(RESPONSE_MULTIPLE);
break;
case "qt_cloze":
$question =& new ASS_ClozeTestGUI();
break;
case "qt_matching":
$question =& new ASS_MatchingQuestionGUI();
break;
case "qt_ordering":
$question =& new ASS_OrderingQuestionGUI();
break;
case "qt_imagemap":
$question =& new ASS_ImagemapQuestionGUI();
break;
case "qt_javaapplet":
$question =& new ASS_JavaAppletGUI();
break;
case "qt_text":
$question =& new ASS_TextQuestionGUI();
break;
}
if ($question_id > 0)
{
$question->object->loadFromDb($question_id);
}
return $question;
}
Here is the call graph for this function:| ilObjTest::createRandomSolutionsForAllUsers | ( | ) |
Definition at line 5267 of file class.ilObjTest.php.
References $ilUser, $query, $user_id, ilObjUser::_getAllUserData(), _instanciateQuestion(), getActiveTestUser(), and getTestId().
{
global $ilDB;
global $ilUser;
$db =& $ilDB->db;
$sequence_arr = array_flip($this->questions);
$sequence = join($sequence_arr, ",");
require_once("./classes/class.ilObjUser.php");
$logins = ilObjUser::_getAllUserData(array("login"));
foreach ($logins as $login)
{
$user_id = $login["usr_id"];
$old_active = $this->getActiveTestUser($user_id);
if ($old_active) {
$query = sprintf("UPDATE tst_active SET lastindex = %s, sequence = %s, postponed = %s, tries = %s WHERE user_fi = %s AND test_fi = %s",
$db->quote("0"),
$db->quote($sequence),
$db->quote(""),
$db->quote("1"),
$db->quote($user_id),
$db->quote($this->getTestId())
);
} else {
$sequence_arr = array_flip($this->questions);
$sequence = join($sequence_arr, ",");
$query = sprintf("INSERT INTO tst_active (active_id, user_fi, test_fi, sequence, postponed, lastindex, tries, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, NULL)",
$db->quote($user_id),
$db->quote($this->getTestId()),
$db->quote($sequence),
$db->quote(""),
$db->quote("0"),
$db->quote("1")
);
}
$db->query($query);
}
foreach ($this->questions as $question_id) {
$question =& ilObjTest::_instanciateQuestion($question_id);
foreach ($logins as $login)
{
$question->createRandomSolution($this->getTestId(), $login["usr_id"]);
}
}
}
Here is the call graph for this function:| ilObjTest::createReference | ( | ) |
Creates a database reference id for the object.
Creates a database reference id for the object (saves the object to the database and creates a reference id in the database)
public
Reimplemented from ilObject.
Definition at line 405 of file class.ilObjTest.php.
References $result, and saveToDb().
{
$result = parent::createReference();
$this->saveToDb();
return $result;
}
Here is the call graph for this function:| ilObjTest::decrementSequenceByResult | ( | $ | a_sequence | ) |
decrements sequence to the next wrong answered question
| int | sequence |
Definition at line 2645 of file class.ilObjTest.php.
References $ilUser, $result, getQuestionIdFromActiveUserSequence(), and getTestResult().
{
for($i = $a_sequence; $i > 0; $i--)
{
$qid = $this->getQuestionIdFromActiveUserSequence($i);
foreach($this->getTestResult($ilUser->getId()) as $result)
{
if($qid == $result['qid'])
{
if($result['max'] != $result['reached'])
{
return $i;
}
}
}
}
return 1;
}
Here is the call graph for this function:| ilObjTest::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 469 of file class.ilObjTest.php.
References ilObject::deleteMetaData(), and deleteTest().
{
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// delet meta data
$this->deleteMetaData();
//put here your module specific stuff
$this->deleteTest();
return true;
}
Here is the call graph for this function:| ilObjTest::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 2113 of file class.ilObjTest.php.
References $query, and $result.
Referenced by removeAllTestEditings().
{
$query = sprintf("DELETE FROM tst_active WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
}
Here is the caller graph for this function:| ilObjTest::deleteResults | ( | $ | user_id = "", |
|
| $ | a_delete_active = false | |||
| ) |
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 2131 of file class.ilObjTest.php.
References $query, $result, $user_id, and getTestId().
{
if ($user_id) {
$query = sprintf("DELETE FROM tst_solutions WHERE test_fi = %s AND user_fi = %s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->query($query);
$query = sprintf("DELETE FROM tst_test_result WHERE test_fi = %s AND user_fi = %s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->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",
$this->ilias->db->quote($sequence),
$this->ilias->db->quote("1"),
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->query($query);
$query = sprintf("DELETE FROM tst_active_qst_sol_settings WHERE test_fi = %s AND user_fi = %s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->query($query);
if($a_delete_active)
{
$query = "DELETE FROM tst_active ".
"WHERE user_fi = '".$user_id."' ".
"AND test_fi = '".$this->getTestId()."'";
$this->ilias->db->query($query);
}
}
}
Here is the call graph for this function:| 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 493 of file class.ilObjTest.php.
References $query, $result, $row, ilUtil::getDataDir(), ilObject::getId(), removeAllTestEditings(), and removeQuestion().
Referenced by delete().
{
$query = sprintf("SELECT active_id FROM tst_active WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->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",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
if (count($active_array))
{
foreach ($active_array as $active_id)
{
$query = sprintf("DELETE FROM tst_times WHERE active_fi = %s",
$this->ilias->db->quote($active_id)
);
$result = $this->ilias->db->query($query);
}
}
$query = sprintf("DELETE FROM tst_mark WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->removeQuestion($row->question_fi);
}
$query = sprintf("DELETE FROM tst_tests WHERE test_id = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$query = sprintf("DELETE FROM tst_test_random_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
// delete export files
$tst_data_dir = ilUtil::getDataDir()."/tst_data";
$directory = $tst_data_dir."/tst_".$this->getId();
if (is_dir($directory))
{
$directory = escapeshellarg($directory);
exec("rm -rf $directory");
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::disinviteUser | ( | $ | user_id | ) |
Disinvites a user from a test.
Disinvites a user from a test
| integer | $user_id The database id of the disinvited user public |
Definition at line 5843 of file class.ilObjTest.php.
| ilObjTest::duplicate | ( | ) |
Duplicates the ilObjTest object.
Duplicates the ilObjTest object
public
Definition at line 898 of file class.ilObjTest.php.
References $counter, $data, $query, $result, and testTitleExists().
{
$clone = $this;
$clone->set_id(-1);
$counter = 2;
while ($this->testTitleExists($this->get_title() . " ($counter)")) {
$counter++;
}
$clone->set_title($this->get_title() . " ($counter)");
$clone->set_owner($this->ilias->account->id);
$clone->setAuthor($this->ilias->account->fullname);
$clone->saveToDb($this->ilias->db);
// Duplicate questions
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getId())
);
$result = $this->ilias->db->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)",
$this->ilias->db->quote($clone->getId()),
$this->ilias->db->quote($data->question_fi),
$this->ilias->db->quote($data->sequence)
);
$insert_result = $this->ilias->db->query($query);
}
}
Here is the call graph for this function:| 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 2276 of file class.ilObjTest.php.
References $ilUser, and _instanciateQuestion().
Referenced by insertQuestion().
{
global $ilUser;
$question =& ilObjTest::_instanciateQuestion($question_id);
$duplicate_id = $question->duplicate(true);
return $duplicate_id;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::endingTimeReached | ( | ) |
Returns true if the ending time of a test is reached.
Returns true if the ending time of a test is reached An ending time is not available for self assessment tests
Definition at line 4056 of file class.ilObjTest.php.
References getEndingTime(), and getTestType().
{
if ($this->getTestType() == TYPE_ASSESSMENT || $this->getTestType() == TYPE_ONLINE_TEST)
{
if ($this->getEndingTime())
{
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndingTime(), $matches);
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now > $epoch_time)
{
// ending time reached
return true;
}
}
}
return false;
}
Here is the call graph for this function:| 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 3194 of file class.ilObjTest.php.
References $q, $result, and $row.
{
$q = sprintf("SELECT * FROM tst_eval_settings WHERE user_fi = %s",
$this->ilias->db->quote("$user_id")
);
$result = $this->ilias->db->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::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 3230 of file class.ilObjTest.php.
References $q, $result, and $row.
{
$q = sprintf("SELECT * FROM tst_eval_settings WHERE user_fi = %s",
$this->ilias->db->quote("$user_id")
);
$result = $this->ilias->db->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)",
$this->ilias->db->quote("$user_id"),
$this->ilias->db->quote(sprintf("%01d", $settings_array["qworkedthrough"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["pworkedthrough"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["timeofwork"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["atimeofwork"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["firstvisit"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["lastvisit"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["resultspoints"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["resultsmarks"])),
$this->ilias->db->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",
$this->ilias->db->quote(sprintf("%01d", $settings_array["qworkedthrough"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["pworkedthrough"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["timeofwork"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["atimeofwork"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["firstvisit"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["lastvisit"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["resultspoints"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["resultsmarks"])),
$this->ilias->db->quote(sprintf("%01d", $settings_array["distancemedian"])),
$this->ilias->db->quote("$update")
);
}
$result = $this->ilias->db->query($q);
}
| & ilObjTest::evalStatistical | ( | $ | user_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 3314 of file class.ilObjTest.php.
References $q, $result, $row, $user_id, getTestId(), and getTestResult().
{
// global $ilBench;
$test_result =& $this->getTestResult($user_id);
$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",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->query($q);
$times = array();
$first_visit = "";
$last_visit = "";
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;
}
$mark_obj = $this->mark_schema->get_matching_mark($percentage);
$first_date = getdate($first_visit);
$last_date = getdate($last_visit);
$qworkedthrough = 0;
$query_worked_through = sprintf("SELECT test_result_id FROM tst_test_result WHERE user_fi = %s AND test_fi = %s",
//$query_worked_through = sprintf("SELECT DISTINCT(question_fi) FROM tst_solutions WHERE user_fi = %s AND test_fi = %s",
$this->ilias->db->quote("$user_id"),
$this->ilias->db->quote($this->getTestId())
);
$worked_through_result = $this->ilias->db->query($query_worked_through);
if (!$worked_through_result->numRows())
{
$atimeofwork = 0;
}
else
{
$atimeofwork = $max_time / $worked_through_result->numRows();
}
$result_mark = "";
$passed = "";
if ($mark_obj)
{
$result_mark = $mark_obj->get_short_name();
if ($mark_obj->get_passed())
{
$passed = 1;
}
else
{
$passed = 0;
}
}
$result_array = array(
"qworkedthrough" => $worked_through_result->numRows(),
"qmax" => count($this->questions),
"pworkedthrough" => ($worked_through_result->numRows()) / count($this->questions),
"timeofwork" => $max_time,
"atimeofwork" => $atimeofwork,
"firstvisit" => $first_date,
"lastvisit" => $last_date,
"resultspoints" => $test_result["test"]["total_reached_points"],
"maxpoints" => $test_result["test"]["total_max_points"],
"resultsmarks" => $result_mark,
"passed" => $passed,
"distancemedian" => "0"
);
foreach ($test_result as $key => $value)
{
if (preg_match("/\d+/", $key))
{
$result_array[$key] = $value;
}
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::evalTotalFinished | ( | ) |
Returns the number of total finished tests.
Returns the number of total finished tests
Definition at line 3500 of file class.ilObjTest.php.
| ilObjTest::evalTotalFinishedAverageTime | ( | ) |
Returns the average processing time for total finished tests.
Returns the average processing time for total finished tests
Definition at line 3585 of file class.ilObjTest.php.
References $counter, $q, $result, and $row.
{
$q = sprintf("SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.tries > 0 AND tst_active.active_id = tst_times.active_fi",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->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::evalTotalFinishedPassed | ( | ) |
Returns the total passed tests and the average reached points.
Returns the total passed tests and the average reached points
Definition at line 3519 of file class.ilObjTest.php.
References $counter, $q, $res, $result, $row, and getTestResult().
{
$q = sprintf("SELECT * FROM tst_active WHERE test_fi = %s AND tries > 0",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($q);
$points = array();
$passed_tests = 0;
$failed_tests = 0;
$maximum_points = 0;
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$res =& $this->getTestResult($row->user_fi);
if ((!$res["test"]["total_reached_points"]) or (!$res["test"]["total_max_points"]))
{
$percentage = 0.0;
}
else
{
$percentage = ($res["test"]["total_reached_points"] / $res["test"]["total_max_points"]) * 100.0;
}
$mark_obj = $this->mark_schema->get_matching_mark($percentage);
$maximum_points = $res["test"]["total_max_points"];
if ($mark_obj)
{
if ($mark_obj->get_passed()) {
$passed_tests++;
array_push($points, $res["test"]["total_reached_points"]);
}
else
{
$failed_tests++;
}
}
}
$reached_points = 0;
$counter = 0;
foreach ($points as $key => $value)
{
$reached_points += $value;
$counter++;
}
if ($counter)
{
$average_points = round($reached_points / $counter);
}
else
{
$average_points = 0;
}
return array(
"total_passed" => $passed_tests,
"total_failed" => $failed_tests,
"average_points" => $average_points,
"maximum_points" => $maximum_points
);
}
Here is the call graph for this function:| ilObjTest::evalTotalPersons | ( | ) |
Returns a result for a condition check on the class.
Calculates the results of a test for a given user and returns true if the user passed the test, else false
| integer | $a_exc_id object id of the test object | |
| string | $a_operator The operator which should be checked | |
| mixed | $a_value ??? |
| object | $a_meta_data meta data object get meta data object of glossary object |
Definition at line 3149 of file class.ilObjTest.php.
| & ilObjTest::evalTotalPersonsArray | ( | ) |
Returns all persons who started the test.
Returns all persons who started the test
Definition at line 3471 of file class.ilObjTest.php.
References $q, $result, and $row.
Referenced by getTotalPointsArray(), and getTotalPointsPassedArray().
{
$q = sprintf("SELECT tst_active.user_fi, 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",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($q);
$persons_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
if (strlen($row->firstname.$row->lastname.$row->title) == 0)
{
$persons_array[$row->user_fi] = $this->lng->txt("deleted_user");
}
else
{
$persons_array[$row->user_fi] = trim("$row->lastname, $row->firstname $row->title");
}
}
return $persons_array;
}
Here is the caller graph for this function:| ilObjTest::exportFileItems | ( | $ | a_target_dir, | |
| &$ | expLog | |||
| ) |
export files of file itmes
Definition at line 4684 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);
}
}
Here is the caller graph for this function:| ilObjTest::exportPagesXML | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| $ | a_target_dir, | |||
| &$ | expLog | |||
| ) |
export pages of test to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 4526 of file class.ilObjTest.php.
References $ilBench, exportFileItems(), exportXMLMediaObjects(), exportXMLMetaData(), and exportXMLPageObjects().
{
global $ilBench;
$this->mob_ids = array();
$this->file_ids = array();
$attrs = array();
$attrs["Type"] = "Test";
$a_xml_writer->xmlStartTag("ContentObject", $attrs);
// MetaData
$this->exportXMLMetaData($a_xml_writer);
// PageObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
$ilBench->start("ContentObjectExport", "exportPageObjects");
$this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog);
$ilBench->stop("ContentObjectExport", "exportPageObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
// MediaObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
$ilBench->start("ContentObjectExport", "exportMediaObjects");
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportMediaObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
// FileItems
$expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
$ilBench->start("ContentObjectExport", "exportFileItems");
$this->exportFileItems($a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportFileItems");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
$a_xml_writer->xmlEndTag("ContentObject");
}
Here is the call graph for this function:| ilObjTest::exportXMLMediaObjects | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| $ | a_target_dir, | |||
| &$ | expLog | |||
| ) |
export media objects to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 4666 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);
}
}
Here is the caller graph for this function:| ilObjTest::exportXMLMetaData | ( | &$ | a_xml_writer | ) |
export content objects meta data to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 4570 of file class.ilObjTest.php.
References ilObject::getId(), and ilObject::getType().
Referenced by exportPagesXML().
{
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::exportXMLPageObjects | ( | &$ | a_xml_writer, | |
| $ | a_inst, | |||
| &$ | expLog | |||
| ) |
export page objects to xml (see ilias_co.dtd)
| object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 4603 of file class.ilObjTest.php.
References $ilBench, and $xml.
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");
}
}
Here is the caller graph for this function:| ilObjTest::from_xml | ( | $ | xml_text | ) |
Imports the test properties from XML into the test object.
Imports the test properties from XML into the test object
Definition at line 4705 of file class.ilObjTest.php.
References $result, $score_reporting, domxml_open_mem(), setAuthor(), ilObject::setDescription(), setEndingTime(), setIntroduction(), setNrOfTries(), setProcessingTime(), setRandomQuestionCount(), setRandomTest(), setReportingDate(), setScoreReporting(), setSequenceSettings(), setStartingTime(), setTestType(), and ilObject::setTitle().
Referenced by importObject().
{
$result = false;
$this->mark_schema->flush();
$xml_text = preg_replace("/>\s*?</", "><", $xml_text);
$domxml = domxml_open_mem($xml_text);
if (!empty($domxml))
{
$root = $domxml->document_element();
$this->setTitle($root->get_attribute("title"));
$item = $root;
$itemnodes = $item->child_nodes();
foreach ($itemnodes as $index => $node)
{
switch ($node->node_name())
{
case "qticomment":
$comment = $node->get_content();
if (strpos($comment, "Author=") !== false)
{
$comment = str_replace("Author=", "", $comment);
$this->setAuthor($comment);
}
elseif (strpos($comment, "ILIAS Version=") !== false)
{
}
else
{
$this->setDescription($comment);
}
break;
case "duration":
$iso8601period = $node->get_content();
if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
{
$this->enable_processing_time = 1;
$this->setProcessingTime(sprintf("%02d:%02d:%02d", $matches[4], $matches[5], $matches[6]));
}
break;
case "assessmentcontrol":
$score_reporting = $node->get_attribute("solutionswitch");
switch (strtolower($score_reporting))
{
case "1":
case "yes":
$score_reporting = 1;
break;
default:
$score_reporting = 0;
break;
}
$this->setScoreReporting($score_reporting);
break;
case "objectives":
$material = $node->first_child();
if (strcmp($material->get_attribute("label"), "introduction") == 0)
{
$mattext = $material->first_child();
$this->setIntroduction($mattext->get_content());
}
break;
case "qtimetadata":
$metadata_fields = $node->child_nodes();
foreach ($metadata_fields as $index => $metadata_field)
{
$fieldlabel = $metadata_field->first_child();
$fieldentry = $fieldlabel->next_sibling();
switch ($fieldlabel->get_content())
{
case "sequence_settings":
$this->setSequenceSettings($fieldentry->get_content());
break;
case "author":
$this->setAuthor($fieldentry->get_content());
break;
case "test_type":
$this->setTestType($fieldentry->get_content());
break;
case "reporting_date":
$iso8601period = $fieldentry->get_content();
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 "nr_of_tries":
$this->setNrOfTries($fieldentry->get_content());
break;
case "random_test":
$this->setRandomTest($fieldentry->get_content());
break;
case "random_question_count":
$this->setRandomQuestionCount($fieldentry->get_content());
break;
case "starting_time":
$iso8601period = $fieldentry->get_content();
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 = $fieldentry->get_content();
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+/", $fieldlabel->get_content()))
{
$xmlmark = $fieldentry->get_content();
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->add_mark_step($mark_short, $mark_official, $mark_percentage, $mark_passed);
}
}
break;
}
}
$result = true;
}
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & 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 2424 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, and ilObject::_hasUntrashedReference().
{
global $rbacsystem;
$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 = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_hasUntrashedReference($row->obj_id)))
{
$qpl_titles["$row->obj_id"] = $row->title;
}
}
return $qpl_titles;
}
Here is the call graph for this function:| ilObjTest::getActiveTestUser | ( | $ | user_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 2754 of file class.ilObjTest.php.
References $ilUser, $query, $result, and $user_id.
Referenced by createRandomSolutionsForAllUsers(), getAllQuestionsForActiveUser(), getQuestionIdFromActiveUserSequence(), getQuestionTitle(), getTestSummary(), setActiveTestUser(), and startWorkingTime().
{
global $ilDB;
global $ilUser;
$db =& $ilDB->db;
if (!$user_id)
{
$user_id = $ilUser->id;
}
$query = sprintf("SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
$db->quote($user_id),
$db->quote($this->test_id)
);
$result = $db->query($query);
if ($result->numRows())
{
$this->active = $result->fetchRow(DB_FETCHMODE_OBJECT);
}
else
{
$this->active = null;
}
return $this->active;
}
Here is the caller graph for this function:| & ilObjTest::getAllQuestions | ( | ) |
Returns all questions of a test in test order.
Returns all questions of a test in test order
Definition at line 2722 of file class.ilObjTest.php.
References $ilUser, $query, $result, $row, and isRandomTest().
Referenced by getAllQuestionsForActiveUser().
{
global $ilUser;
if ($this->isRandomTest())
{
$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.user_fi = %s AND qpl_questions.question_id IN (" . join($this->questions, ",") . ")",
$this->ilias->db->quote($ilUser->id . "")
);
}
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 = $this->ilias->db->query($query);
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$result_array[$row["question_id"]] = $row;
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getAllQuestionsForActiveUser | ( | ) |
Returns all questions of a test in users order.
Returns all questions of a test in users order
Definition at line 2567 of file class.ilObjTest.php.
References getActiveTestUser(), getAllQuestions(), and getWorkedQuestions().
Referenced by getWrongAnsweredQuestions().
{
$result_array = array();
$active = $this->getActiveTestUser();
$sequence_array = split(",", $active->sequence);
$all_questions = &$this->getAllQuestions();
$worked_questions = &$this->getWorkedQuestions();
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;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getAllSolutionValues | ( | ) |
Gets the.
Gets the
Definition at line 5889 of file class.ilObjTest.php.
References $ilUser, $query, $result, $row, and getTestId().
{
global $ilUser;
$query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s GROUP BY question_fi",
$this->ilias->db->quote($ilUser->id),
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
array_push($result_array, $row->question_fi);
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::getAllTestResults | ( | ) |
returns all test results for all participants
Definition at line 6006 of file class.ilObjTest.php.
References $row, $user_id, _instanciateQuestion(), getECTSGrade(), getInvitedUsers(), getTestId(), and processCSVRow().
{
$participants = $this->getInvitedUsers("matriculation");
$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();
$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($user_id, $this->getTestId());
}
}
if ($max_points > 0)
{
$percentvalue = $reached_points / $max_points;
}
else
{
$percentvalue = 0;
}
$mark_obj = $this->mark_schema->get_matching_mark($percentvalue * 100);
$passed = "";
if ($mark_obj)
{
$mark = $mark_obj->get_official_name();
$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[] = $this->processCSVRow ($row, true);
}
return $results;
}
Here is the call graph for this function:| & ilObjTest::getArrayData | ( | $ | query, | |
| $ | id_field | |||
| ) |
Returns a data as id key list.
Returns a data as id key list
| $query | ||
| $id_field | index for array |
Definition at line 5751 of file class.ilObjTest.php.
References $query, and _getArrayData().
Referenced by getGroupData(), getInvitedUsers(), getRoleData(), and getUserData().
{
return ilObjTest::_getArrayData ($query, $id_field);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getAuthor | ( | ) |
Gets the authors name.
Gets the authors name of the ilObjTest object
Definition at line 1510 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->author;
}
Here is the caller graph for this function:| & 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 3626 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, and ilObject::_hasUntrashedReference().
Referenced by getQuestionsTable(), and randomSelectQuestions().
{
global $rbacsystem;
$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 = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_hasUntrashedReference($row->obj_id)))
{
array_push($result_array, $row->obj_id);
}
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getAvailableQuestionpools | ( | $ | use_object_id = false |
) |
Returns the available question pools for the active user.
Returns the available question pools for the active user
Definition at line 3651 of file class.ilObjTest.php.
References $query, $rbacsystem, $result, $row, and ilObject::_hasUntrashedReference().
{
global $rbacsystem;
$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' ORDER BY object_data.title";
$result = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
if ($rbacsystem->checkAccess("write", $row->ref_id) && ($this->_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;
}
Here is the call graph for this function:| ilObjTest::getCallingScript | ( | ) |
Returns the calling script of the class.
public
Definition at line 416 of file class.ilObjTest.php.
Referenced by getTestResult(), and getTestSummary().
{
return "test.php";
}
Here is the caller graph for this function:| ilObjTest::getCompleteWorkingTime | ( | $ | user_id | ) |
Returns the complete working time in seconds a user worked on the test.
Returns the complete working time in seconds a user worked on the test
Definition at line 3287 of file class.ilObjTest.php.
References $q, $result, $row, and $user_id.
{
$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",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->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::getCountSystem | ( | ) |
Gets the count system for the calculation of points.
Gets the count system for the calculation of points
Definition at line 1701 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->count_system;
}
Here is the caller graph for this function:| ilObjTest::getECTSGrade | ( | $ | reached_points, | |
| $ | max_points | |||
| ) |
Returns the ECTS grade for a number of reached points.
Returns the ECTS grade for a number of reached points
| double | $reached_points The points reached in the test | |
| double | $max_points The maximum number of points for the test |
Definition at line 5029 of file class.ilObjTest.php.
References getTotalPointsPassedArray().
Referenced by getAllTestResults().
{
require_once "./classes/class.ilStatistics.php";
// calculate the median
$passed_statistics = new ilStatistics();
$passed_array =& $this->getTotalPointsPassedArray();
$passed_statistics->setData($passed_array);
$ects_percentiles = array
(
"A" => $passed_statistics->quantile($this->ects_grades["A"]),
"B" => $passed_statistics->quantile($this->ects_grades["B"]),
"C" => $passed_statistics->quantile($this->ects_grades["C"]),
"D" => $passed_statistics->quantile($this->ects_grades["D"]),
"E" => $passed_statistics->quantile($this->ects_grades["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($this->ects_fx, "") != 0)
{
if ($max_points > 0)
{
$percentage = ($reached_points / $max_points) * 100.0;
}
else
{
$percentage = 0.0;
}
if ($percentage >= $this->ects_fx)
{
return "FX";
}
else
{
return "F";
}
}
else
{
return "F";
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getEnableProcessingTime | ( | ) |
Returns the state of the processing time (enabled/disabled).
Returns the state of the processing time (enabled/disabled)
Definition at line 1854 of file class.ilObjTest.php.
Referenced by isMaxProcessingTimeReached().
{
return $this->enable_processing_time;
}
Here is the caller graph for this function:| ilObjTest::getEndingTime | ( | ) |
Returns the ending time of the test.
Returns the ending time of the test
Definition at line 1882 of file class.ilObjTest.php.
Referenced by endingTimeReached(), and to_xml().
{
return $this->ending_time;
}
Here is the caller graph for this function:| ilObjTest::getEstimatedWorkingTime | ( | ) |
Returns the estimated working time for the test calculated from the working time of the contained questions.
Returns the estimated working time for the test calculated from the working time of the contained questions
Definition at line 3683 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;
}
Here is the call graph for this function:| & ilObjTest::getEvaluationGroups | ( | $ | user_id | ) |
Returns an array of groups who are selected for a test evaluation of a given user.
Returns an array of groups who are selected for a test evaluation of a given user
public
Definition at line 5346 of file class.ilObjTest.php.
References $query, $result, $row, and $user_id.
{
$groups = array();
$query = sprintf("SELECT group_fi FROM tst_eval_groups WHERE test_fi = %s AND evaluator_fi = %s",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($user_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$groups[$row["group_fi"]] = $row["group_fi"];
}
}
return $groups;
}
| & ilObjTest::getEvaluationUsers | ( | $ | user_id | ) |
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 5321 of file class.ilObjTest.php.
References $query, $result, $row, $user_id, and $users.
{
$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",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($user_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$users[$row["user_fi"]] = trim($row["firstname"] ." " . $row["lastname"]);
}
}
return $users;
}
| & ilObjTest::getExistingQuestions | ( | ) |
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 2450 of file class.ilObjTest.php.
References $data, $ilUser, $query, $result, and isRandomTest().
{
global $ilUser;
$existing_questions = array();
if ($this->isRandomTest())
{
$query = sprintf("SELECT qpl_questions.original_id FROM qpl_questions, tst_test_random_question WHERE tst_test_random_question.test_fi = %s AND tst_test_random_question.user_fi = %s AND tst_test_random_question.question_fi = qpl_questions.question_id",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($ilUser->id . "")
);
}
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",
$this->ilias->db->quote($this->getTestId())
);
}
$result = $this->ilias->db->query($query);
while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push($existing_questions, $data->original_id);
}
return $existing_questions;
}
Here is the call graph for this function:| ilObjTest::getExportDirectory | ( | ) |
Get the location of the export directory for the test.
Get the location of the export directory for the test
public
Definition at line 697 of file class.ilObjTest.php.
References ilUtil::getDataDir().
{
$export_dir = ilUtil::getDataDir()."/tst_data"."/tst_".$this->getId()."/export";
return $export_dir;
}
Here is the call graph for this function:| ilObjTest::getExportFiles | ( | $ | dir | ) |
Get a list of the already exported files in the export directory.
Get a list of the already exported files in the export directory
Definition at line 712 of file class.ilObjTest.php.
References $file.
{
// 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 2665 of file class.ilObjTest.php.
References $ilUser, $result, getQuestionCount(), getQuestionIdFromActiveUserSequence(), and getTestResult().
{
global $ilUser;
$results = $this->getTestResult($ilUser->getId());
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;
}
Here is the call graph for this function:| & ilObjTest::getGroupData | ( | $ | ids | ) |
Definition at line 5767 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");
}
Here is the call graph for this function:| ilObjTest::getImagePath | ( | ) |
Returns the image path for web accessable images of a test.
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_TEST/images
public
Definition at line 3850 of file class.ilObjTest.php.
References ilObject::getId().
Referenced by getQuestionsTable().
{
return CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/images/";
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getImagePathWeb | ( | ) |
Returns the web image path for web accessable images of a test.
Returns the web image path for web accessable images of a test The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_TEST/images
public
Definition at line 3863 of file class.ilObjTest.php.
References ilObject::getId(), and ilUtil::removeTrailingPathSeparators().
{
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/" . $this->getId() . "/images/";
return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
}
Here is the call graph for this function:| ilObjTest::getImportDirectory | ( | ) |
Get the import directory location of the test.
Get the import directory location of the test
Definition at line 831 of file class.ilObjTest.php.
References ilUtil::getDataDir().
{
$import_dir = ilUtil::getDataDir()."/tst_data/tst_import";
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}
Here is the call graph for this function:| ilObjTest::getImportMapping | ( | ) |
get array of (two) new created questions for import id
Definition at line 5007 of file class.ilObjTest.php.
{
if (!is_array($this->import_mapping))
{
return array();
}
else
{
return $this->import_mapping;
}
}
| ilObjTest::getIntroduction | ( | ) |
Gets the introduction.
Gets the introduction text of the ilObjTest object
Definition at line 1552 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->introduction;
}
Here is the caller graph for this function:| & ilObjTest::getInvitedUsers | ( | $ | user_id = "", |
|
| $ | order = "login, lastname, firstname" | |||
| ) |
Returns a list of all invited users in a test.
Returns a list of all invited users in a test
Definition at line 5689 of file class.ilObjTest.php.
References $query, $user_id, and getArrayData().
Referenced by getAllTestResults().
{
$result_array = array();
if (is_numeric($user_id))
$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",
$this->ilias->db->quote($this->test_id),
$user_id,
$order
);
else
{
$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",
$this->ilias->db->quote($this->test_id),
$order
);
}
return $this->getArrayData($query, "usr_id");
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getMCScoring | ( | ) |
Gets the scoring type for multiple choice questions.
Gets the scoring type for multiple choice questions
Definition at line 1739 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->mc_scoring;
}
Here is the caller graph for this function:| ilObjTest::getNrOfTries | ( | ) |
Returns the nr of tries for the test.
Returns the nr of tries for the test
Definition at line 1805 of file class.ilObjTest.php.
Referenced by hasNrOfTriesRestriction(), isNrOfTriesReached(), and to_xml().
{
return $this->nr_of_tries;
}
Here is the caller graph for this function:| ilObjTest::getProcessingTime | ( | ) |
Returns the processing time for the test.
Returns the processing time for the test
Definition at line 1819 of file class.ilObjTest.php.
Referenced by getProcessingTimeInSeconds().
{
return $this->processing_time;
}
Here is the caller graph for this function:| ilObjTest::getProcessingTimeInSeconds | ( | ) |
Returns the processing time for the test in seconds.
Returns the processing time for the test in seconds
Definition at line 1833 of file class.ilObjTest.php.
References getProcessingTime().
Referenced by isMaxProcessingTimeReached().
{
if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $this->getProcessingTime(), $matches))
{
return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3];
}
else
{
return 0;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getQuestionCount | ( | ) |
Returns the number of questions in the test.
Returns the number of questions in the test
Definition at line 5462 of file class.ilObjTest.php.
References $data, $num, getRandomQuestionCount(), getRandomQuestionpools(), and isRandomTest().
Referenced by getFirstSequence(), and incrementSequenceByResult().
{
$num = 0;
if ($this->isRandomTest())
{
if ($this->getRandomQuestionCount())
{
$num = $this->getRandomQuestionCount();
}
else
{
$qpls =& $this->getRandomQuestionpools();
foreach ($qpls as $data)
{
$num += $data["count"];
}
}
}
else
{
$num = count($this->questions);
}
return $num;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getQuestionDataset | ( | $ | question_id | ) |
Returns the dataset for a given question id.
Returns the dataset for a given question id
| integer | $question_id The database id of the question |
Definition at line 2406 of file class.ilObjTest.php.
References $query, $result, and $row.
{
$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",
$this->ilias->db->quote("$question_id")
);
$result = $this->ilias->db->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 2549 of file class.ilObjTest.php.
References $ilUser, and getActiveTestUser().
Referenced by decrementSequenceByResult(), getFirstSequence(), and incrementSequenceByResult().
{
global $ilUser;
$active = $this->getActiveTestUser();
$sequence_array = split(",", $active->sequence);
return $this->questions[$sequence_array[$sequence-1]];
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getQuestionsTable | ( | $ | sortoptions, | |
| $ | 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 4082 of file class.ilObjTest.php.
References $ilUser, $query, $result, $row, getAvailableQuestionpoolIDs(), and getImagePath().
{
global $ilUser;
$where = "";
if (strlen($filter_text) > 0) {
switch($sel_filter_type) {
case "title":
$where = " AND qpl_questions.title LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
case "comment":
$where = " AND qpl_questions.comment LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
case "author":
$where = " AND qpl_questions.author LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
}
}
if ($filter_question_type && (strcmp($filter_question_type, "all") != 0))
{
$where .= " AND qpl_question_type.type_tag = " . $this->ilias->db->quote($filter_question_type);
}
if ($filter_questionpool && (strcmp($filter_questionpool, "all") != 0))
{
$where .= " AND qpl_questions.obj_fi = $filter_questionpool";
}
// build sort order for sql query
$order = "";
$images = array();
if (count($sortoptions)) {
foreach ($sortoptions as $key => $value) {
switch($key) {
case "title":
$order = " ORDER BY title $value";
$images["title"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "comment":
$order = " ORDER BY comment $value";
$images["comment"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "type":
$order = " ORDER BY question_type_id $value";
$images["type"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "author":
$order = " ORDER BY author $value";
$images["author"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "created":
$order = " ORDER BY created $value";
$images["created"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "updated":
$order = " ORDER BY TIMESTAMP14 $value";
$images["updated"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
case "qpl":
$order = " ORDER BY obj_fi $value";
$images["qpl"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />";
break;
}
}
}
$maxentries = $ilUser->prefs["hits_per_page"];
if ($maxentries < 1)
{
$maxentries = 9999;
}
$available_pools =& $this->getAvailableQuestionpoolIDs();
$available = "";
if (count($available_pools))
{
$available = " AND qpl_questions.obj_fi IN (" . join($available_pools, ",") . ")";
}
else
{
return array();
}
if ($completeonly)
{
$available .= " AND qpl_questions.complete = " . $this->ilias->db->quote("1");
}
// get all questions in the test
$query = sprintf("SELECT qpl_questions.original_id, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14 FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND tst_test_question.test_fi = %s",
$this->ilias->db->quote($this->getTestId() . "")
);
$result = $this->ilias->db->query($query);
$original_ids = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if (strcmp($row[0], "") != 0)
{
array_push($original_ids, $row[0]);
}
}
$original_clause = " ISNULL(qpl_questions.original_id)";
if (count($original_ids))
{
$original_clause = " ISNULL(qpl_questions.original_id) AND qpl_questions.question_id NOT IN (" . join($original_ids, ",") . ")";
}
$query = "SELECT qpl_questions.question_id, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14 FROM qpl_questions, qpl_question_type WHERE $original_clause$available AND qpl_questions.question_type_fi = qpl_question_type.question_type_id $where$order$limit";
$query_result = $this->ilias->db->query($query);
$max = $query_result->numRows();
if ($startrow > $max -1)
{
$startrow = $max - ($max % $maxentries);
}
else if ($startrow < 0)
{
$startrow = 0;
}
$limit = " LIMIT $startrow, $maxentries";
$query = "SELECT qpl_questions.*, qpl_questions.TIMESTAMP + 0 AS TIMESTAMP14, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type WHERE $original_clause $available AND qpl_questions.question_type_fi = qpl_question_type.question_type_id $where$order$limit";
$query_result = $this->ilias->db->query($query);
$rows = array();
if ($query_result->numRows())
{
while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($rows, $row);
}
}
$nextrow = $startrow + $maxentries;
if ($nextrow > $max - 1)
{
$nextrow = $startrow;
}
$prevrow = $startrow - $maxentries;
if ($prevrow < 0)
{
$prevrow = 0;
}
return array(
"rows" => $rows,
"images" => $images,
"startrow" => $startrow,
"nextrow" => $nextrow,
"prevrow" => $prevrow,
"step" => $maxentries,
"rowcount" => $max
);
}
Here is the call graph for this function:| ilObjTest::getQuestiontext | ( | $ | question_id | ) |
Returns the question text for a given question.
Returns the question text for a given question
| integer | $question_id The question id |
Definition at line 5663 of file class.ilObjTest.php.
References $query, $res, $result, and $row.
{
$res = "";
if ($question_id)
{
$query = sprintf("SELECT question_text FROM qpl_questions WHERE question_id = %s",
$this->ilias->db->quote($question_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$res = $row["question_text"];
}
}
return $res;
}
| ilObjTest::getQuestionTitle | ( | $ | sequence | ) |
Returns the title of a question with a given sequence number.
Returns the title of a question with a given sequence number
| integer | $sequence The sequence number of the question public |
Definition at line 2374 of file class.ilObjTest.php.
References $ilUser, $query, $result, $row, and getActiveTestUser().
{
global $ilUser;
if ($ilUser->id > 0)
{
$active = $this->getActiveTestUser($ilUser->id);
$seq = split(",", $active->sequence);
$query = sprintf("SELECT title from qpl_questions WHERE question_id = %s",
$this->ilias->db->quote($this->questions[$seq[$sequence-1]])
);
}
else
{
$query = sprintf("SELECT title from qpl_questions WHERE question_id = %s",
$this->ilias->db->quote($this->questions[$sequence])
);
}
$result = $this->ilias->db->query($query);
$row = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $row->title;
}
Here is the call graph for this function:| & ilObjTest::getQuestionTitles | ( | ) |
Returns the titles of the test questions in question sequence.
Returns the titles of the test questions in question sequence
Definition at line 2347 of file class.ilObjTest.php.
References $query, $result, $row, and isRandomTest().
{
$titles = array();
if (!$this->isRandomTest())
{
global $ilDB;
$query = sprintf("SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($titles, $row["title"]);
}
}
return $titles;
}
Here is the call graph for this function:| ilObjTest::getQuestionType | ( | $ | question_id | ) |
Returns the question type of a question with a given id.
Returns the question type of a question with a given id
| integer | $question_id The database id of the question |
Definition at line 2483 of file class.ilObjTest.php.
References $data, $query, and $result.
Referenced by createQuestionGUI().
{
if ($question_id < 1)
return -1;
$query = sprintf("SELECT type_tag FROM qpl_questions, qpl_question_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_question_type.question_type_id",
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
if ($result->numRows() == 1) {
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $data->type_tag;
} else {
return "";
}
}
Here is the caller graph for this function:| ilObjTest::getRandomQuestionCount | ( | ) |
Gets the number of random questions used for a random test.
Gets the number of random questions used for a random test
Definition at line 1538 of file class.ilObjTest.php.
Referenced by getQuestionCount(), isComplete(), and to_xml().
{
return $this->random_question_count;
}
Here is the caller graph for this function:| & ilObjTest::getRandomQuestionpools | ( | ) |
Returns an array containing the random questionpools saved to the database.
Returns an array containing the random questionpools saved to the database
public
Definition at line 1358 of file class.ilObjTest.php.
References $counter, $query, $result, and $row.
Referenced by getQuestionCount(), and isComplete().
{
$qpls = array();
$counter = 0;
$query = sprintf("SELECT * FROM tst_test_random WHERE test_fi = %s ORDER BY test_random_id",
$this->ilias->db->quote($this->getTestId() . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$qpls[$counter] = array(
"index" => $counter,
"count" => $row["num_of_q"],
"qpl" => $row["questionpool_fi"]
);
$counter++;
}
}
return $qpls;
}
Here is the caller graph for this function:| ilObjTest::getReportingDate | ( | ) |
Gets the reporting date.
Gets the reporting date of the ilObjTest object
Definition at line 1791 of file class.ilObjTest.php.
Referenced by canViewResults(), and to_xml().
{
return $this->reporting_date;
}
Here is the caller graph for this function:| & ilObjTest::getRoleData | ( | $ | ids | ) |
Definition at line 5781 of file class.ilObjTest.php.
References $query, and getArrayData().
{
if (!is_array($ids) || count($ids) ==0)
return array();
$result_array = array();
$query = sprintf("SELECT obj_id, description, title FROM role_data, object_data o WHERE o.obj_id=role_id AND role_id IN (%s)",
join ($ids,",")
);
return $this->getArrayData ($query, "obj_id");
}
Here is the call graph for this function:| ilObjTest::getScoreReporting | ( | ) |
Gets the score reporting.
Gets the score reporting of the ilObjTest object
Definition at line 1687 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->score_reporting;
}
Here is the caller graph for this function:| ilObjTest::getSequenceSettings | ( | ) |
Gets the sequence settings.
Gets the sequence settings of the ilObjTest object
Definition at line 1673 of file class.ilObjTest.php.
Referenced by to_xml().
{
return $this->sequence_settings;
}
Here is the caller graph for this function:| ilObjTest::getStartingTime | ( | ) |
Returns the starting time of the test.
Returns the starting time of the test
Definition at line 1868 of file class.ilObjTest.php.
Referenced by startingTimeReached(), and to_xml().
{
return $this->starting_time;
}
Here is the caller graph for this function:| ilObjTest::getStartingTimeOfUser | ( | $ | user_id | ) |
Returns the unix timestamp of the time a user started a test.
Returns the unix timestamp of the time a user started a test
| integer | $user_id The user id |
Definition at line 6122 of file class.ilObjTest.php.
References $query, $result, $row, $user_id, and getTestId().
{
global $ilDB;
if ($user_id < 1) return FALSE;
$query = sprintf("SELECT tst_times.started FROM tst_times, tst_active WHERE tst_active.user_fi = %s AND tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.started",
$ilDB->quote($user_id . ""),
$ilDB->quote($this->getTestId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches))
{
return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
Here is the call graph for this function:| ilObjTest::getTestId | ( | ) |
Gets the database id of the additional test data.
Gets the database id of the additional test data
Definition at line 1566 of file class.ilObjTest.php.
Referenced by createRandomSolutionsForAllUsers(), deleteResults(), evalStatistical(), getAllSolutionValues(), getAllTestResults(), getStartingTimeOfUser(), getTestResult(), getTextAnswer(), getWorkedQuestions(), and saveECTSStatus().
{
return $this->test_id;
}
Here is the caller graph for this function:| & ilObjTest::getTestResult | ( | $ | user_id | ) |
Calculates the results of a test for a given user.
Calculates the results of a test for a given user and returns an array with all test results
Definition at line 2884 of file class.ilObjTest.php.
References $row, $user_id, ASS_Question::_getInternalLinkHref(), ASS_Question::_getMaximumPoints(), ASS_Question::_getQuestionInfo(), ASS_Question::_getReachedPoints(), ASS_Question::_getSuggestedSolution(), ASS_Question::_getSuggestedSolutionCount(), getCallingScript(), getTestId(), isRandomTest(), loadQuestions(), and ilUtil::prepareFormOutput().
Referenced by decrementSequenceByResult(), evalStatistical(), evalTotalFinishedPassed(), getFirstSequence(), getTotalPointsArray(), getTotalPointsPassedArray(), getWrongAnsweredQuestions(), and incrementSequenceByResult().
{
// global $ilBench;
if ($this->isRandomTest())
{
$this->loadQuestions($user_id);
}
$add_parameter = "?ref_id=$this->ref_id&cmd=run";
$total_max_points = 0;
$total_reached_points = 0;
// retrieve the active test dataset for the user containing
// questions sequence and other information
//$active = $this->getActiveTestUser($user_id);
//$sequence_array = array();
//if (strlen($active->sequence))
//{
// $sequence_array = split(",", $active->sequence);
// sort($sequence_array, SORT_NUMERIC);
//}
$key = 1;
$result_array = array();
foreach ($this->questions as $value)
{
$max_points = ASS_Question::_getMaximumPoints($value);
$total_max_points += $max_points;
$reached_points = ASS_Question::_getReachedPoints($user_id, $this->getTestId(), $value);
$total_reached_points += $reached_points;
if ($max_points > 0)
{
$percentvalue = $reached_points / $max_points;
}
else
{
$percentvalue = 0;
}
if (ASS_Question::_getSuggestedSolutionCount($value) == 1)
{
$solution_array =& ASS_Question::_getSuggestedSolution($value, 0);
$href = ASS_Question::_getInternalLinkHref($solution_array["internal_link"]);
}
elseif (ASS_Question::_getSuggestedSolutionCount($value) > 1)
{
$href = "see_details_for_further_information";
}
else
{
$href = "";
}
$info =& ASS_Question::_getQuestionInfo($value);
$row = array(
"nr" => "$key",
"title" => "<a href=\"" . $this->getCallingScript() . "$add_parameter&evaluation=" . $value . "\">" . ilUtil::prepareFormOutput($info["title"]) . "</a>",
"max" => sprintf("%d", $max_points),
"reached" => sprintf("%d", $reached_points),
"percent" => sprintf("%2.2f ", ($percentvalue) * 100) . "%",
"solution" => $href,
"type" => $info["type_tag"],
"qid" => $value
);
array_push($result_array, $row);
$key++;
}
$result_array["test"]["total_max_points"] = $total_max_points;
$result_array["test"]["total_reached_points"] = $total_reached_points;
if ((!$total_reached_points) or (!$total_max_points))
{
$percentage = 0.0;
}
else
{
$percentage = ($total_reached_points / $total_max_points) * 100.0;
}
$mark_obj = $this->mark_schema->get_matching_mark($percentage);
$passed = "";
if ($mark_obj)
{
if ($mark_obj->get_passed())
{
$passed = 1;
}
else
{
$passed = 0;
}
}
$result_array["test"]["passed"] = $passed;
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getTestSummary | ( | $ | user_id | ) |
Calculates the overview of a test for a given user.
and returns an array with all test questions
Definition at line 2983 of file class.ilObjTest.php.
References $row, $user, $user_id, _getSolvedQuestions(), _instanciateQuestion(), getActiveTestUser(), getCallingScript(), isRandomTest(), and loadQuestions().
{
global $ilDB;
// global $ilBench;
if ($this->isRandomTest())
{
$this->loadQuestions($user_id);
}
$add_parameter = "?ref_id=$this->ref_id&cmd=run&crs_show_result=0&";
$key = 1;
$result_array = array();
$active = $this->getActiveTestUser();
$solved_questions = ilObjTest::_getSolvedQuestions($this->test_id, $user_id);
$user = new IlObjUser($user_id);
foreach ($this->questions as $val) {
$question =& ilObjTest::_instanciateQuestion($val);
if (is_object($question))
{
$answers = $question->getSolutionValues($this->test_id, $user);
$visited = count($answers);
$solved = 0;
if (array_key_exists($question->getId(),$solved_questions)) {
$solved = $solved_questions[$question->getId()]->solved;
}
$row = array(
"nr" => "$key",
"href_goto" => $this->getCallingScript() . "$add_parameter&sequence=$key",
"href_setsolved" => $this->getCallingScript() . "$add_parameter&question_id=".$question->getId()."&set_solved=".(($solved)?"0":"1"),
"title" => $question->getTitle(),
"qid" => $question->getId(),
"visited" => $visited,
"solved" => (($solved)?"1":"0"),
"description" => $question->getComment(),
"points" => $question->getMaximumPoints()
);
array_push($result_array, $row);
$key++;
}
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::getTestType | ( | ) |
Gets the test type.
Gets the test type
Definition at line 1777 of file class.ilObjTest.php.
Referenced by canViewResults(), endingTimeReached(), isOnlineTest(), startingTimeReached(), and to_xml().
{
return $this->test_type;
}
Here is the caller graph for this function:| ilObjTest::getTextAnswer | ( | $ | user_id, | |
| $ | question_id | |||
| ) |
Returns the text answer of a given user for a given question.
Returns the text answer of a given user for a given question
| integer | $user_id The user id | |
| integer | $question_id The question id |
Definition at line 5634 of file class.ilObjTest.php.
References $query, $res, $result, $row, $user_id, and getTestId().
{
$res = "";
if (($user_id) && ($question_id))
{
$query = sprintf("SELECT value1 FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s",
$this->ilias->db->quote($user_id . ""),
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($question_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$res = $row["value1"];
}
}
return $res;
}
Here is the call graph for this function:| & ilObjTest::getTotalPointsArray | ( | ) |
Returns an array with the total points of all users who participated the test.
Returns an array with the total points of all users who participated the test This array could be used for statistics
Definition at line 3420 of file class.ilObjTest.php.
References $user_id, evalTotalPersonsArray(), and getTestResult().
{
$totalpoints_array = array();
$all_users =& $this->evalTotalPersonsArray();
foreach ($all_users as $user_id => $user_name)
{
$test_result =& $this->getTestResult($user_id);
array_push($totalpoints_array, $test_result["test"]["total_reached_points"]);
}
return $totalpoints_array;
}
Here is the call graph for this function:| & ilObjTest::getTotalPointsPassedArray | ( | ) |
Returns an array with the total points of all users who passed the test.
Returns an array with the total points of all users who passed the test This array could be used for statistics
Definition at line 3441 of file class.ilObjTest.php.
References $user_id, evalTotalPersonsArray(), and getTestResult().
Referenced by getECTSGrade().
{
$totalpoints_array = array();
$all_users =& $this->evalTotalPersonsArray();
foreach ($all_users as $user_id => $user_name)
{
$test_result =& $this->getTestResult($user_id);
$reached = $test_result["test"]["total_reached_points"];
$total = $test_result["test"]["total_max_points"];
$percentage = $reached/$total;
$mark = $this->mark_schema->get_matching_mark($percentage*100.0);
if ($mark)
{
if ($mark->get_passed())
{
array_push($totalpoints_array, $test_result["test"]["total_reached_points"]);
}
}
}
return $totalpoints_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjTest::getUserData | ( | $ | ids | ) |
Returns a data of all users specified by id list.
Returns a data of all users specified by id list
| $usr_ids | kommaseparated list of ids |
Definition at line 5727 of file class.ilObjTest.php.
References $query, and getArrayData().
{
if (!is_array($ids) || count($ids) ==0)
return array();
$result_array = array();
$query = sprintf("SELECT usr_id, login, lastname, firstname, client_ip as clientip FROM usr_data WHERE usr_id IN (%s) ORDER BY login",
join ($ids,",")
);
return $this->getArrayData ($query, "usr_id");
}
Here is the call graph for this function:| & ilObjTest::getWorkedQuestions | ( | ) |
Gets the id's of all questions a user already worked through.
Gets the id's of all questions a user already worked through
Definition at line 2698 of file class.ilObjTest.php.
References $ilUser, $query, $result, $row, and getTestId().
Referenced by getAllQuestionsForActiveUser().
{
global $ilUser;
$query = sprintf("SELECT * FROM tst_solutions WHERE user_fi = %s AND test_fi = %s GROUP BY question_fi",
$this->ilias->db->quote($ilUser->id),
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
array_push($result_array, $row->question_fi);
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::getWrongAnsweredQuestions | ( | ) |
Definition at line 2589 of file class.ilObjTest.php.
References $ilUser, $result, getAllQuestionsForActiveUser(), and getTestResult().
{
global $ilUser;
foreach($all_questions =& $this->getAllQuestionsForActiveUser() as $question)
{
foreach($this->getTestResult($ilUser->getId()) as $result)
{
if($result['qid'] == $question['question_id'])
{
if($result['max'] != $result['reached'])
{
$wrong[] = $question;
}
}
}
}
return $wrong ? $wrong : array();
}
Here is the call graph for this function:| ilObjTest::hasNrOfTriesRestriction | ( | ) |
returns if the numbers of tries have to be checked
Definition at line 5989 of file class.ilObjTest.php.
References getNrOfTries().
{
return $this->getNrOfTries() != 0;
}
Here is the call graph for this function:| ilObjTest::ilClone | ( | $ | a_parent_ref | ) |
copy all entries of your object.
public
| integer | ref_id of parent object |
Reimplemented from ilObject.
Definition at line 440 of file class.ilObjTest.php.
References $rbacadmin.
{
global $rbacadmin;
// always call parent ilClone function first!!
$new_ref_id = parent::ilClone($a_parent_ref);
// get object instance of ilCloned object
//$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
// create a local role folder & default roles
//$roles = $newObj->initDefaultRoles();
// ...finally assign role to creator of object
//$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");
// always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree!
//unset($newObj);
// ... and finally always return new reference ID!!
return $new_ref_id;
}
| ilObjTest::ilObjTest | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = true | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 317 of file class.ilObjTest.php.
References $ilUser, ilObject::$lng, ilObject::ilObject(), and retrieveTestTypes().
Referenced by _clone(), _getTestResult(), and _isComplete().
{
global $ilUser;
$this->type = "tst";
$this->mark_schema = new ASS_MarkSchema();
//$this->ilObject($a_id, $a_call_by_reference);
$this->retrieveTestTypes();
$this->test_id = -1;
$this->author = $ilUser->fullname;
$this->introduction = "";
$this->questions = array();
$this->sequence_settings = TEST_FIXED_SEQUENCE;
$this->score_reporting = REPORT_AFTER_TEST;
$this->reporting_date = "";
$this->nr_of_tries = 0;
$this->starting_time = "";
$this->ending_time = "";
$this->processing_time = "00:00:00";
$this->enable_processing_time = "0";
$this->test_type = TYPE_ASSESSMENT;
$this->ects_output = 0;
$this->ects_fx = "";
$this->random_test = 0;
$this->random_question_count = "";
$this->count_system = COUNT_PARTIAL_SOLUTIONS;
$this->mc_scoring = SCORE_ZERO_POINTS_WHEN_UNANSWERED;
global $lng;
$lng->loadLanguageModule("assessment");
$this->mark_schema->create_simple_schema($lng->txt("failed_short"), $lng->txt("failed_official"), 0, 0, $lng->txt("passed_short"), $lng->txt("passed_official"), 50, 1);
$this->ects_grades = array(
"A" => 90,
"B" => 65,
"C" => 35,
"D" => 10,
"E" => 0
);
/*
if ($a_id == 0)
{
$new_meta =& new ilMetaData();
$this->assignMetaData($new_meta);
}
*/
$this->ilObject($a_id, $a_call_by_reference);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::importObject | ( | $ | source, | |
| $ | questionpool_id | |||
| ) |
Imports a test from XML into the ILIAS database.
Imports a test from XML into the ILIAS database
Definition at line 4844 of file class.ilObjTest.php.
References ilObject::$lng, $result, $xml, from_xml(), setTestType(), ilObject::setTitle(), and to_xml().
{
$ilias_version = "";
$error = 0;
if (($source == 'none') || (!$source) || $file_info["error"] > UPLOAD_ERR_OK)
{
$this->ilias->raiseError("No file selected!",$this->ilias->error_obj->FATAL);
$error = 1;
}
if (!$error)
{
// import file as a test
$fh = fopen($source, "r");
if (!$fh)
{
$this->ilias->raiseError("Error opening the file!",$this->ilias->error_obj->FATAL);
$error = 1;
return $error;
}
$xml = fread($fh, filesize($source));
$result = fclose($fh);
if (!$result)
{
$this->ilias->raiseError("Error closing the file!",$this->ilias->error_obj->FATAL);
$error = 1;
return $error;
}
$assessment_part = "";
if (preg_match("/ILIAS Version\=(\d+)\.(\d+)\.?(\d?)/", $xml, $matches))
{
$major_version = $matches[1];
unset($matches[0]);
$ilias_version = join($matches, ".");
if ($major_version == 2)
{
$this->setTestType(TYPE_SELF_ASSESSMENT);
global $lng;
$lng->loadLanguageModule("assessment");
$this->setTitle($lng->txt("imported_test"));
$assessment_part = $this->to_xml();
if (preg_match("/(<assessment[^>]*>.*?<\/assessment>)/si", $assessment_part, $matches))
{
$assessment_part = $matches[1];
}
}
}
$found_assessment = preg_match("/(<assessment[^>]*>.*?<\/assessment>)/si", $xml, $matches);
if ($found_assessment or $assessment_part)
{
if ((!$found_assessment) and ($assessment_part))
{
$matches[1] = $assessment_part;
}
// read test properties
$succeeded = $this->from_xml($matches[1]);
if (!$succeeded)
{
// $this->ilias->raiseError("The test properties do not contain proper values!",$this->ilias->error_obj->MESSAGE);
$error = 1;
return $error;
}
}
else
{
// $this->ilias->raiseError("No test properties found. Cannot import test!",$this->ilias->error_obj->MESSAGE);
$error = 1;
return $error;
}
$question_counter = 1;
$this->import_mapping = array();
if (preg_match_all("/(<item[^>]*>.*?<\/item>)/si", $xml, $matches))
{
foreach ($matches[1] as $index => $item)
{
// get identifier
if (preg_match("/(<item[^>]*>)/is", $item, $start_tag))
{
if (preg_match("/(ident=\"([^\"]*)\")/is", $start_tag[1], $ident))
{
$ident = $ident[2];
}
}
$question = "";
$qt = "";
if (preg_match("/<fieldlabel>QUESTIONTYPE<\/fieldlabel>\s*<fieldentry>(.*?)<\/fieldentry>/is", $item, $questiontype))
{
$qt = $questiontype[1];
}
if (preg_match("/<qticomment>Questiontype\=(.*?)<\/qticomment>/is", $item, $questiontype))
{
$qt = $questiontype[1];
}
if (strlen($qt))
{
switch ($qt)
{
case CLOZE_TEST_IDENTIFIER:
$question = new ASS_ClozeTest();
break;
case IMAGEMAP_QUESTION_IDENTIFIER:
$question = new ASS_ImagemapQuestion();
break;
case MATCHING_QUESTION_IDENTIFIER:
$question = new ASS_MatchingQuestion();
break;
case MULTIPLE_CHOICE_QUESTION_IDENTIFIER:
$question = new ASS_MultipleChoice();
break;
case ORDERING_QUESTION_IDENTIFIER:
$question = new ASS_OrderingQuestion();
break;
case JAVAAPPLET_QUESTION_IDENTIFIER:
$question = new ASS_JavaApplet();
break;
case TEXT_QUESTION_IDENTIFIER:
$question = new ASS_TextQuestion();
break;
}
if ($question)
{
$question->setObjId($questionpool_id);
if ($question->from_xml("<questestinterop>$item</questestinterop>"))
{
$question->saveToDb();
$q_1_id = $question->getId();
$question_id = $question->duplicate(true);
$this->questions[$question_counter++] = $question_id;
$this->import_mapping[$ident] = array(
"pool" => $q_1_id, "test" => $question_id);
}
else
{
$this->ilias->raiseError($this->lng->txt("error_importing_question"), $this->ilias->error_obj->MESSAGE);
}
}
}
}
}
}
//echo "<br>"; var_dump($this->import_mapping);
$result = array(
"error" => $error,
"version" => $ilias_version
);
return $result;
}
Here is the call graph for this function:| ilObjTest::incrementSequenceByResult | ( | $ | a_sequence | ) |
increments sequence to the next wrong answered question
| int | sequence |
Definition at line 2615 of file class.ilObjTest.php.
References $ilUser, $result, getQuestionCount(), getQuestionIdFromActiveUserSequence(), and getTestResult().
{
global $ilUser;
for($i = $a_sequence+1; $i <= $this->getQuestionCount(); $i++)
{
$qid = $this->getQuestionIdFromActiveUserSequence($i);
foreach($this->getTestResult($ilUser->getId()) as $result)
{
if($qid == $result['qid'])
{
if($result['max'] != $result['reached'])
{
return $i;
}
}
}
}
return ($this->getQuestionCount()+1);
}
Here is the call graph for this function:| ilObjTest::initDefaultRoles | ( | ) |
init default roles settings
If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)
public
Reimplemented from ilObject.
Definition at line 576 of file class.ilObjTest.php.
References $rbacadmin, and $roles.
{
global $rbacadmin;
// create a local role folder
//$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
// create moderator role and assign role to rolefolder...
//$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
//$roles[] = $roleObj->getId();
//unset($rfoldObj);
//unset($roleObj);
return $roles ? $roles : array();
}
| ilObjTest::insertQuestion | ( | $ | question_id | ) |
Insert a question in the list of questions.
Insert a question in the list of questions
| integer | $question_id The database id of the inserted question public |
Definition at line 2294 of file class.ilObjTest.php.
References $data, $query, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), duplicateQuestionForTest(), loadQuestions(), logAction(), and saveCompleteStatus().
{
$duplicate_id = $this->duplicateQuestionForTest($question_id);
// get maximum sequence index in test
$query = sprintf("SELECT MAX(sequence) AS seq FROM tst_test_question WHERE test_fi=%s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$sequence = 1;
if ($result->numRows() == 1)
{
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$sequence = $data->seq + 1;
}
$query = sprintf("INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($duplicate_id),
$this->ilias->db->quote($sequence)
);
$result = $this->ilias->db->query($query);
if ($result != DB_OK)
{
// Error
}
else
{
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_added", ilObjAssessmentFolder::_getLogLanguage()) . ": " . $sequence, $duplicate_id);
}
}
// remove test_active entries, because test has changed
$query = sprintf("DELETE FROM tst_active WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$this->loadQuestions();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::inviteGroup | ( | $ | group_id | ) |
Invites all users of a group to a test.
Invites all users of a group to a test
| integer | $group_id The database id of the invited group public |
Definition at line 5804 of file class.ilObjTest.php.
References $user_id, and inviteUser().
{
require_once "./classes/class.ilObjGroup.php";
$group = new ilObjGroup($group_id);
$members = $group->getGroupMemberIds();
foreach ($members as $user_id)
{
$this->inviteUser($user_id);
}
}
Here is the call graph for this function:| ilObjTest::inviteRole | ( | $ | role_id | ) |
Invites all users of a role to a test.
Invites all users of a role to a test
| integer | $group_id The database id of the invited group public |
Definition at line 5823 of file class.ilObjTest.php.
References $rbacreview, $role_id, $user_id, and inviteUser().
{
global $rbacreview;
$members = $rbacreview->assignedUsers($role_id,"usr_id");
foreach ($members as $user_id)
{
$this->inviteUser($user_id);
}
}
Here is the call graph for this function:| ilObjTest::inviteUser | ( | $ | user_id, | |
| $ | client_ip = "" | |||
| ) |
Invites a user to a test.
Invites a user to a test
| integer | $user_id The database id of the invited user public |
Definition at line 5860 of file class.ilObjTest.php.
References $query, $result, and $user_id.
Referenced by inviteGroup(), and inviteRole().
{
$query = sprintf("INSERT IGNORE INTO tst_invited_user (test_fi, user_fi, clientip) VALUES (%s, %s, %s)",
$this->ilias->db->quote($this->test_id),
$this->ilias->db->quote($user_id),
$this->ilias->db->quote($client_ip)
);
$result = $this->ilias->db->query($query);
}
Here is the caller graph for this function:| ilObjTest::isActiveTestSubmitted | ( | $ | user_id = null |
) |
returns if the active for user_id has been submitted
Definition at line 5972 of file class.ilObjTest.php.
References $ilUser, $query, $result, and $user_id.
{
global $ilUser;
if (!is_numeric($user_id))
$user_id = $ilUser->getId();
$query = sprintf("SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=1",
$this->ilias->db->quote($this->test_id),
$this->ilias->db->quote($user_id)
);
$result = $this->ilias->db->query($query);
return $result->numRows() == 1;
}
| ilObjTest::isComplete | ( | ) |
Returns true, if a test is complete for use.
Returns true, if a test is complete for use
Definition at line 933 of file class.ilObjTest.php.
References $count, getRandomQuestionCount(), getRandomQuestionpools(), ilObject::getTitle(), and isRandomTest().
Referenced by saveCompleteStatus(), and saveToDb().
{
if (($this->getTitle()) and ($this->author) and (count($this->mark_schema->mark_steps)) and (count($this->questions)))
{
return true;
}
else
{
if ($this->isRandomTest())
{
$arr = $this->getRandomQuestionpools();
if (count($arr) && ($this->getRandomQuestionCount() > 0))
{
return true;
}
$count = 0;
foreach ($arr as $array)
{
$count += $array["count"];
}
if ($count)
{
return true;
}
}
return false;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::isMaxProcessingTimeReached | ( | $ | starting_time | ) |
Returns wheather the maximum processing time for a test is reached or not.
Returns wheather the maximum processing time for a test is reached or not
| long | $starting_time The unix timestamp of the starting time of the test |
Definition at line 6160 of file class.ilObjTest.php.
References $processing_time, $starting_time, getEnableProcessingTime(), and getProcessingTimeInSeconds().
{
if ($this->getEnableProcessingTime())
{
$processing_time = $this->getProcessingTimeInSeconds();
$now = mktime();
if ($now > ($starting_time + $processing_time))
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
Here is the call graph for this function:| ilObjTest::isNrOfTriesReached | ( | $ | tries | ) |
returns if number of tries are reached
Definition at line 5998 of file class.ilObjTest.php.
References getNrOfTries().
{
return $tries >= (int) $this->getNrOfTries();
}
Here is the call graph for this function:| ilObjTest::isOnlineTest | ( | ) |
gets TestType equals Online Test
Definition at line 5913 of file class.ilObjTest.php.
References getTestType().
{
return $this->getTestType()==TYPE_ONLINE_TEST;
}
Here is the call graph for this function:| ilObjTest::isRandomTest | ( | ) |
Gets the status of the $random_test attribute.
Gets the status of the $random_test attribute
Definition at line 1524 of file class.ilObjTest.php.
Referenced by getAllQuestions(), getExistingQuestions(), getQuestionCount(), getQuestionTitles(), getTestResult(), getTestSummary(), isComplete(), loadQuestions(), removeAllTestEditings(), saveToDb(), and to_xml().
{
return $this->random_test;
}
Here is the caller graph for this function:| ilObjTest::loadFromDb | ( | ) |
Loads a ilObjTest object from a database.
Loads a ilObjTest object from a database
| object | $db A pear DB object | |
| integer | $test_id A unique key which defines the test in the database public |
Definition at line 1390 of file class.ilObjTest.php.
References $data, $query, $result, and loadQuestions().
Referenced by read().
{
$db = $this->ilias->db;
$query = sprintf("SELECT * FROM tst_tests WHERE obj_fi = %s",
$db->quote($this->getId())
);
$result = $db->query($query);
if (strcmp(strtolower(get_class($result)), db_result) == 0)
{
if ($result->numRows() == 1)
{
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$this->test_id = $data->test_id;
$this->author = $data->author;
$this->test_type = $data->test_type_fi;
$this->introduction = $data->introduction;
$this->sequence_settings = $data->sequence_settings;
$this->score_reporting = $data->score_reporting;
$this->nr_of_tries = $data->nr_of_tries;
$this->processing_time = $data->processing_time;
$this->enable_processing_time = $data->enable_processing_time;
$this->reporting_date = $data->reporting_date;
$this->starting_time = $data->starting_time;
$this->ending_time = $data->ending_time;
$this->ects_output = $data->ects_output;
$this->ects_grades = array(
"A" => $data->ects_a,
"B" => $data->ects_b,
"C" => $data->ects_c,
"D" => $data->ects_d,
"E" => $data->ects_e
);
$this->ects_fx = $data->ects_fx;
$this->random_test = $data->random_test;
$this->random_question_count = $data->random_question_count;
$this->mark_schema->flush();
$this->mark_schema->loadFromDb($this->test_id);
$this->count_system = $data->count_system;
$this->mc_scoring = $data->mc_scoring;
$this->loadQuestions();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::loadQuestions | ( | $ | user_id = "" |
) |
Load the test question id's from the database.
Load the test question id's from the database
| integer | $user_id The user id of the test user (necessary for random tests) public |
Definition at line 1443 of file class.ilObjTest.php.
References $data, $ilUser, $query, $result, $user_id, and isRandomTest().
Referenced by getTestResult(), getTestSummary(), insertQuestion(), loadFromDb(), questionMoveDown(), questionMoveUp(), and removeQuestion().
{
global $ilUser;
$db = $this->ilias->db;
$this->questions = array();
if (strcmp($user_id, "") == 0)
{
$user_id = $ilUser->id;
}
if ($this->isRandomTest())
{
$query = sprintf("SELECT tst_test_random_question.* FROM tst_test_random_question, qpl_questions WHERE tst_test_random_question.test_fi = %s AND tst_test_random_question.user_fi = %s AND qpl_questions.question_id = tst_test_random_question.question_fi ORDER BY sequence",
$db->quote($this->test_id . ""),
$db->quote($user_id . "")
);
}
else
{
$query = sprintf("SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
$db->quote($this->test_id . "")
);
}
$result = $db->query($query);
$index = 1;
while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
$this->questions[$index++] = $data->question_fi;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::logAction | ( | $ | logtext = "", |
|
| $ | question_id = "" | |||
| ) |
Logs an action into the Test&Assessment log.
Logs an action into the Test&Assessment log
| string | $logtext The log text | |
| integer | $question_id If given, saves the question id to the database public |
Definition at line 5561 of file class.ilObjTest.php.
References $ilUser, ilObjAssessmentFolder::_addLog(), and ASS_Question::_getOriginalId().
Referenced by insertQuestion(), questionMoveDown(), questionMoveUp(), removeAllTestEditings(), removeQuestion(), saveQuestionsToDb(), and saveToDb().
{
global $ilUser;
$original_id = "";
if (strcmp($question_id, "") != 0)
{
$original_id = ASS_Question::_getOriginalId($question_id);
}
include_once "./classes/class.ilObjAssessmentFolder.php";
ilObjAssessmentFolder::_addLog($ilUser->id, $this->getId(), $logtext, $question_id, $original_id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::modifyExportIdentifier | ( | $ | a_tag, | |
| $ | a_param, | |||
| $ | a_value | |||
| ) |
Returns the installation id for a given identifier.
Returns the installation id for a given identifier
private
Definition at line 4586 of file class.ilObjTest.php.
References ilUtil::insertInstIntoID().
{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
$a_value = ilUtil::insertInstIntoID($a_value);
}
return $a_value;
}
Here is the call graph for this function:| ilObjTest::moveQuestions | ( | $ | move_questions, | |
| $ | target_index, | |||
| $ | insert_mode | |||
| ) |
Move questions to another position.
Move questions to another position
| array | $move_questions An array with the question id's of the questions to move | |
| integer | $target_index The question id of the target position | |
| integer | $insert_mode 0, if insert before the target position, 1 if insert after the target position public |
Definition at line 3980 of file class.ilObjTest.php.
References $counter, and saveQuestionsToDb().
{
$this->questions = array_values($this->questions);
$array_pos = array_search($target_index, $this->questions);
if ($insert_mode == 0)
{
$part1 = array_slice($this->questions, 0, $array_pos);
$part2 = array_slice($this->questions, $array_pos);
}
else if ($insert_mode == 1)
{
$part1 = array_slice($this->questions, 0, $array_pos + 1);
$part2 = array_slice($this->questions, $array_pos + 1);
}
foreach ($move_questions as $question_id)
{
if (!(array_search($question_id, $part1) === FALSE))
{
unset($part1[array_search($question_id, $part1)]);
}
if (!(array_search($question_id, $part2) === FALSE))
{
unset($part2[array_search($question_id, $part2)]);
}
}
$part1 = array_values($part1);
$part2 = array_values($part2);
$new_array = array_values(array_merge($part1, $move_questions, $part2));
$this->questions = array();
$counter = 1;
foreach ($new_array as $question_id)
{
$this->questions[$counter] = $question_id;
$counter++;
}
$this->saveQuestionsToDb();
}
Here is the call graph for this function:| ilObjTest::notify | ( | $ | a_event, | |
| $ | a_ref_id, | |||
| $ | a_parent_non_rbac_id, | |||
| $ | a_node_id, | |||
| $ | a_params = 0 | |||
| ) |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)
public
| string | event | |
| integer | reference id of object where the event occured | |
| array | passes optional parameters if required |
Reimplemented from ilObject.
Definition at line 606 of file class.ilObjTest.php.
References $_GET, $tree, and ilObject::getType().
{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
//exit;
break;
case "cut":
//echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
//exit;
break;
case "copy":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
//exit;
break;
case "paste":
//echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
//exit;
break;
case "new":
//echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
//exit;
break;
}
// At the beginning of the recursive process it avoids second call of the notify function with the same parameter
if ($a_node_id==$_GET["ref_id"])
{
$parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
$parent_type = $parent_obj->getType();
if($parent_type == $this->getType())
{
$a_node_id = (int) $tree->getParentId($a_node_id);
}
}
parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
}
Here is the call graph for this function:| & ilObjTest::processCSVRow | ( | $ | row, | |
| $ | quoteAll = FALSE, |
|||
| $ | separator = ";" | |||
| ) |
Convertes an array for CSV usage.
Processes an array as a CSV row and converts the array values to correct CSV values. The "converted" array is returned
| array | $row The array containing the values for a CSV row | |
| string | $quoteAll Indicates to quote every value (=TRUE) or only values containing quotes and separators (=FALSE, default) | |
| string | $separator The value separator in the CSV row (used for quoting) (; = default) |
Definition at line 6080 of file class.ilObjTest.php.
References $row, and $separator.
Referenced by getAllTestResults().
{
$resultarray = array();
foreach ($row as $rowindex => $entry)
{
$surround = FALSE;
if ($quoteAll)
{
$surround = TRUE;
}
if (strpos($entry, "\"") !== FALSE)
{
$entry = str_replace("\"", "\"\"", $entry);
$surround = TRUE;
}
if (strpos($entry, $separator) !== FALSE)
{
$surround = TRUE;
}
// replace all CR LF with LF (for Excel for Windows compatibility
$entry = str_replace(chr(13).chr(10), chr(10), $entry);
if ($surround)
{
$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
}
else
{
$resultarray[$rowindex] = utf8_decode($entry);
}
}
return $resultarray;
}
Here is the caller graph for this function:| ilObjTest::questionMoveDown | ( | $ | question_id | ) |
Moves a question down in order.
Moves a question down in order
| integer | $question_id The database id of the question to be moved down public |
Definition at line 2228 of file class.ilObjTest.php.
References $data, $query, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), loadQuestions(), and logAction().
{
// Move a question down in sequence
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($data->sequence + 1)
);
$result = $this->ilias->db->query($query);
if ($result->numRows() == 1)
{
// OK, it's not the last question, so move it down
$data_next = $result->fetchRow(DB_FETCHMODE_OBJECT);
// change next dataset
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$this->ilias->db->quote($data->sequence),
$this->ilias->db->quote($data_next->test_question_id)
);
$result = $this->ilias->db->query($query);
// move actual dataset down
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$this->ilias->db->quote($data->sequence + 1),
$this->ilias->db->quote($data->test_question_id)
);
$result = $this->ilias->db->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($data->sequence) . " => " . ($data->sequence+1), $question_id);
}
}
$this->loadQuestions();
}
Here is the call graph for this function:| ilObjTest::questionMoveUp | ( | $ | question_id | ) |
Moves a question up in order.
Moves a question up in order
| integer | $question_id The database id of the question to be moved up public |
Definition at line 2181 of file class.ilObjTest.php.
References $data, $query, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), loadQuestions(), and logAction().
{
// Move a question up in sequence
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
if ($data->sequence > 1) {
// OK, it's not the top question, so move it up
$query = sprintf("SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($data->sequence - 1)
);
$result = $this->ilias->db->query($query);
$data_previous = $result->fetchRow(DB_FETCHMODE_OBJECT);
// change previous dataset
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$this->ilias->db->quote($data->sequence),
$this->ilias->db->quote($data_previous->test_question_id)
);
$result = $this->ilias->db->query($query);
// move actual dataset up
$query = sprintf("UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
$this->ilias->db->quote($data->sequence - 1),
$this->ilias->db->quote($data->test_question_id)
);
$result = $this->ilias->db->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($data->sequence) . " => " . ($data->sequence-1), $question_id);
}
}
$this->loadQuestions();
}
Here is the call graph for this function:| ilObjTest::randomSelectQuestions | ( | $ | nr_of_questions, | |
| $ | questionpool, | |||
| $ | use_obj_id = 0, |
|||
| $ | qpls = "" | |||
| ) |
Returns a random selection of questions.
Returns a random selection of questions
| integer | $nr_of_questions Number of questions to return | |
| integer | $questionpool ID of questionpool to choose the questions from (0 = all available questionpools) | |
| boolean | $user_obj_id Use the object id instead of the reference id when set to true | |
| array | $qpls An array of questionpool id's if the random questions should only be chose from the contained questionpools |
Definition at line 3711 of file class.ilObjTest.php.
References $idx, $query, $rbacsystem, $result, $row, and getAvailableQuestionpoolIDs().
{
global $rbacsystem;
// get the questionpool id if a questionpool ref id was entered
if ($questionpool != 0)
{
// retrieve object id
if (!$use_obj_id)
{
$query = sprintf("SELECT obj_id FROM object_reference WHERE ref_id = %s",
$this->ilias->db->quote("$questionpool")
);
$result = $this->ilias->db->query($query);
$row = $result->fetchRow(DB_FETCHMODE_ARRAY);
$questionpool = $row[0];
}
}
// get all existing questions in the test
$query = sprintf("SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND tst_test_question.test_fi = %s",
$this->ilias->db->quote($this->getTestId() . "")
);
$result = $this->ilias->db->query($query);
$original_ids = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if (strcmp($row[0], "") != 0)
{
array_push($original_ids, $row[0]);
}
}
$original_clause = "";
if (count($original_ids))
{
$original_clause = " AND ISNULL(qpl_questions.original_id) AND qpl_questions.question_id NOT IN (" . join($original_ids, ",") . ")";
}
// get a list of questionpools which are not allowed for the test (only for random selection of questions in test questions editor)
if (($questionpool == 0) && (!is_array($qpls)))
{
$available_pools =& $this->getAvailableQuestionpoolIDs();
$available = "";
$constraint_qpls = "";
if (count($available_pools))
{
$available = " AND qpl_questions.obj_fi IN (" . join($available_pools, ",") . ")";
}
else
{
return array();
}
}
$result_array = array();
if ($questionpool == 0)
{
if (is_array($qpls))
{
if (count($qpls) > 0)
{
$qplidx = array();
foreach ($qpls as $idx => $arr)
{
array_push($qplidx, $arr["qpl"]);
}
$constraint_qpls = " AND qpl_questions.obj_fi IN (" . join($qplidx, ",") . ")";
}
}
$query = "SELECT COUNT(question_id) FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause";
}
else
{
$query = sprintf("SELECT COUNT(question_id) FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s$original_clause",
$this->ilias->db->quote("$questionpool")
);
}
$result = $this->ilias->db->query($query);
$row = $result->fetchRow(DB_FETCHMODE_ARRAY);
if (($row[0]) <= $nr_of_questions)
{
// take all available questions
if ($questionpool == 0)
{
$query = "SELECT question_id FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause";
}
else
{
$query = sprintf("SELECT question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s AND qpl_questions.complete = '1'$original_clause",
$this->ilias->db->quote("$questionpool")
);
}
$result = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ARRAY))
{
if ((!in_array($row[0], $this->questions)) && (strcmp($row[0], "") != 0))
{
$result_array[$row[0]] = $row[0];
}
}
}
else
{
// select a random number out of the maximum number of questions
mt_srand((double)microtime()*1000000);
$random_number = mt_rand(0, $row[0] - 1);
$securitycounter = 500;
while ((count($result_array) < $nr_of_questions) && ($securitycounter > 0))
{
if ($questionpool == 0)
{
$query = "SELECT question_id FROM qpl_questions, object_data WHERE ISNULL(qpl_questions.original_id) AND object_data.type = 'qpl' AND object_data.obj_id = qpl_questions.obj_fi$available$constraint_qpls AND qpl_questions.complete = '1'$original_clause LIMIT $random_number, 1";
}
else
{
$query = sprintf("SELECT question_id FROM qpl_questions WHERE ISNULL(qpl_questions.original_id) AND obj_fi = %s AND qpl_questions.complete = '1'$original_clause LIMIT $random_number, 1",
$this->ilias->db->quote("$questionpool")
);
}
$result = $this->ilias->db->query($query);
$result_row = $result->fetchRow(DB_FETCHMODE_ARRAY);
if ((!in_array($result_row[0], $this->questions)) && (strcmp($result_row[0], "") != 0))
{
$result_array[$result_row[0]] = $result_row[0];
}
$random_number = mt_rand(0, $row[0] - 1);
$securitycounter--;
}
}
return $result_array;
}
Here is the call graph for this function:| ilObjTest::read | ( | $ | a_force_db = false |
) |
read object data from db into object
| boolean | public |
Reimplemented from ilObject.
Definition at line 426 of file class.ilObjTest.php.
References loadFromDb().
{
parent::read($a_force_db);
$this->loadFromDb();
// $this->meta_data =& new ilMetaData($this->getType(), $this->getId());
}
Here is the call graph for this function:| ilObjTest::removeAllTestEditings | ( | $ | question_id = "" |
) |
Removes all references to the question in executed tests in case the question has been changed.
Removes all references to the question in executed tests in case the question has been changed. If a question was changed it cannot be guaranteed that the content and the meaning of the question is the same as before. So we have to delete all already started or completed tests using that question. Therefore we have to delete all references to that question in tst_solutions and the tst_active entries which were created for the user and test in the tst_solutions entry.
public
Definition at line 2053 of file class.ilObjTest.php.
References $query, $query2, $query3, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), clearEvalSelectedGroups(), clearEvalSelectedUsers(), deleteActiveTests(), isRandomTest(), and logAction().
Referenced by deleteTest(), removeNonRandomTestData(), removeQuestion(), and removeRandomTestData().
{
// remove test_active entries, because test has changed
$this->deleteActiveTests();
// remove selected users/groups
$this->clearEvalSelectedUsers();
$this->clearEvalSelectedGroups();
// remove the question from tst_solutions
if ($question_id)
{
$query = sprintf("DELETE FROM tst_solutions WHERE test_fi = %s AND question_fi = %s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($question_id)
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings WHERE test_fi = %s AND question_fi=%s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($question_id)
);
$query3 = sprintf("DELETE FROM tst_test_result WHERE test_fi = %s AND question_fi = %s",
$this->ilias->db->quote($this->getTestId()),
$this->ilias->db->quote($question_id)
);
} else {
$query = sprintf("DELETE FROM tst_solutions WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$query2 = sprintf("DELETE FROM tst_active_qst_sol_settings WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$query3 = sprintf("DELETE FROM tst_test_result WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
}
$result = $this->ilias->db->query($query);
$result = $this->ilias->db->query($query2);
$result = $this->ilias->db->query($query3);
if ($this->isRandomTest())
{
$query = sprintf("DELETE FROM tst_test_random_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
}
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_user_data_removed", ilObjAssessmentFolder::_getLogLanguage()));
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::removeNonRandomTestData | ( | ) |
Removes all test data of a non random test when a test was set to random test.
Removes all test data of a non random test when a test was set to random test
private
Definition at line 5521 of file class.ilObjTest.php.
References $query, $result, removeAllTestEditings(), and saveCompleteStatus().
{
// delete eventually set questions of a previous non-random test
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$this->questions = array();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::removeQuestion | ( | $ | question_id | ) |
Removes a question from the test object.
Removes a question from the test object
| integer | $question_id The database id of the question to be removed public |
Definition at line 1998 of file class.ilObjTest.php.
References ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), loadQuestions(), logAction(), removeAllTestEditings(), and saveQuestionsToDb().
Referenced by deleteTest().
{
$question = new ASS_Question();
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_question_removed", ilObjAssessmentFolder::_getLogLanguage()), $question_id);
}
$question->delete($question_id);
$this->removeAllTestEditings($question_id);
$this->loadQuestions();
$this->saveQuestionsToDb();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::removeRandomTestData | ( | ) |
Removes all test data of a random test when a test was set to non random test.
Removes all test data of a random test when a test was set to non random test
private
Definition at line 5540 of file class.ilObjTest.php.
References $query, $result, removeAllTestEditings(), and saveCompleteStatus().
{
// delete eventually set random question pools of a previous random test
$this->removeAllTestEditings();
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$this->questions = array();
$this->saveCompleteStatus();
}
Here is the call graph for this function:| ilObjTest::removeSelectedGroup | ( | $ | group_id, | |
| $ | evaluator_id | |||
| ) |
Disinvites a group from a evaluation.
Disinvites a group from a evaluation
| integer | $group_id The database id of the disinvited group public |
Definition at line 5417 of file class.ilObjTest.php.
| ilObjTest::removeSelectedUser | ( | $ | user_id, | |
| $ | evaluator_id | |||
| ) |
Disinvites a user from a evaluation.
Disinvites a user from a evaluation
| integer | $user_id The database id of the disinvited user public |
Definition at line 5372 of file class.ilObjTest.php.
| ilObjTest::retrieveTestTypes | ( | ) |
Retrieves the test types from the database.
Retrieves the test types from the database and sets the test_types array to the corresponding values.
private
Definition at line 854 of file class.ilObjTest.php.
References $query, $result, and $row.
Referenced by ilObjTest().
{
global $ilDB;
$this->test_types = array();
$query = "SELECT * FROM tst_test_type ORDER BY test_type_id";
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->test_types[$row->test_type_id] = $row->type_tag;
}
}
Here is the caller graph for this function:| ilObjTest::saveCompleteStatus | ( | ) |
Checks if the test is complete and saves the status in the database.
Checks if the test is complete and saves the status in the database
public
Definition at line 1020 of file class.ilObjTest.php.
References ilObject::$ilias, $query, $result, and isComplete().
Referenced by insertQuestion(), removeNonRandomTestData(), and removeRandomTestData().
{
global $ilias;
$db =& $ilias->db;
$complete = 0;
if ($this->isComplete()) {
$complete = 1;
}
if ($this->test_id > 0) {
$query = sprintf("UPDATE tst_tests SET complete = %s WHERE test_id = %s",
$db->quote("$complete"),
$db->quote($this->test_id)
);
$result = $db->query($query);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveECTSStatus | ( | $ | ects_output = 0, |
|
| $ | fx_support = "", |
|||
| $ | ects_a = 90, |
|||
| $ | ects_b = 65, |
|||
| $ | ects_c = 35, |
|||
| $ | ects_d = 10, |
|||
| $ | ects_e = 0 | |||
| ) |
Saves the ECTS status (output of ECTS grades in a test) to the database.
Saves the ECTS status (output of ECTS grades in a test) to the database
public
Definition at line 984 of file class.ilObjTest.php.
References $ects_output, $query, $result, and getTestId().
{
global $ilDB;
if ($this->test_id > 0) {
$fx_support = preg_replace("/,/", ".", $fx_support);
if (preg_match("/\d+/", $fx_support))
{
$fx_support = $fx_support;
}
else
{
$fx_support = "NULL";
}
$query = sprintf("UPDATE tst_tests SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s WHERE test_id = %s",
$ilDB->quote("$ects_output"),
$ilDB->quote($ects_a . ""),
$ilDB->quote($ects_b . ""),
$ilDB->quote($ects_c . ""),
$ilDB->quote($ects_d . ""),
$ilDB->quote($ects_e . ""),
$fx_support,
$this->getTestId()
);
$result = $ilDB->query($query);
$this->ects_output = $ects_output;
$this->ects_fx = $fx_support;
}
}
Here is the call graph for this function:| ilObjTest::saveQuestionsToDb | ( | ) |
Saves the test questions to the database.
Saves the test questions to the database
public
Definition at line 1193 of file class.ilObjTest.php.
References $pos, $query, $result, $row, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), and logAction().
Referenced by moveQuestions(), removeQuestion(), and saveToDb().
{
$oldquestions = array();
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
if ($result->numRows() > 0)
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($oldquestions, $row["question_fi"]);
}
}
}
// delete existing category relations
$query = sprintf("DELETE FROM tst_test_question WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
// create new category relations
foreach ($this->questions as $key => $value) {
$query = sprintf("INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($value . ""),
$this->ilias->db->quote($key . "")
);
$result = $this->ilias->db->query($query);
}
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
$newquestions = array();
if ($result->numRows() > 0)
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($newquestions, $row["question_fi"]);
}
}
foreach ($oldquestions as $index => $question_id)
{
if (strcmp($newquestions[$index], $question_id) != 0)
{
$pos = array_search($question_id, $newquestions);
if ($pos === FALSE)
{
$this->logAction($this->lng->txtlng("assessment", "log_question_removed", ilObjAssessmentFolder::_getLogLanguage()), $question_id);
}
else
{
$this->logAction($this->lng->txtlng("assessment", "log_question_position_changed", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($index+1) . " => " . ($pos+1), $question_id);
}
}
}
foreach ($newquestions as $index => $question_id)
{
if (array_search($question_id, $oldquestions) === FALSE)
{
$this->logAction($this->lng->txtlng("assessment", "log_question_added", ilObjAssessmentFolder::_getLogLanguage()) . ": " . ($index+1), $question_id);
}
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::saveRandomQuestion | ( | $ | question_id | ) |
Saves a random question to the database.
Saves a random question to the database
public
Definition at line 1273 of file class.ilObjTest.php.
References $ilUser, $query, and $result.
{
global $ilUser;
$query = sprintf("SELECT test_random_question_id FROM tst_test_random_question WHERE test_fi = %s AND user_fi = %s",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($ilUser->id . "")
);
$result = $this->ilias->db->query($query);
$query = sprintf("INSERT INTO tst_test_random_question (test_random_question_id, test_fi, user_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($ilUser->id . ""),
$this->ilias->db->quote($question_id . ""),
$this->ilias->db->quote(($result->numRows()+1) . "")
);
$result = $this->ilias->db->query($query);
}
| ilObjTest::saveRandomQuestionCount | ( | $ | total_questions = "NULL" |
) |
Saves the total amount of a tests random questions to the database.
Saves the total amount of a tests random questions to the database
| integer | $total_questions The amount of random questions public |
Definition at line 1300 of file class.ilObjTest.php.
References $query, $result, and setRandomQuestionCount().
{
if (strcmp($total_questions, "NULL") != 0)
{
$this->setRandomQuestionCount($total_questions);
$total_questions = $this->ilias->db->quote($total_questions);
}
$query = sprintf("UPDATE tst_tests SET random_question_count = %s WHERE test_id = %s",
$total_questions,
$this->ilias->db->quote($this->getTestId() . "")
);
$result = $this->ilias->db->query($query);
}
Here is the call graph for this function:| ilObjTest::saveRandomQuestionpools | ( | $ | qpl_array | ) |
Saves the question pools used for a random test.
Saves the question pools used for a random test
| array | $qpl_array An array containing the questionpool id's public |
Definition at line 1323 of file class.ilObjTest.php.
References $count, $query, $result, and ilObjQuestionPool::_getQuestionCount().
{
// delete existing random questionpools
$query = sprintf("DELETE FROM tst_test_random WHERE test_fi = %s",
$this->ilias->db->quote($this->getTestId())
);
$result = $this->ilias->db->query($query);
// create new random questionpools
foreach ($qpl_array as $key => $value) {
if ($value["qpl"] > -1)
{
$count = ilObjQuestionPool::_getQuestionCount($value["qpl"]);
if ($value["count"] > $count)
{
$value["count"] = $count;
}
$query = sprintf("INSERT INTO tst_test_random (test_random_id, test_fi, questionpool_fi, num_of_q, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($this->getTestId() . ""),
$this->ilias->db->quote($value["qpl"] . ""),
$this->ilias->db->quote(sprintf("%d", $value["count"]) . "")
);
$result = $this->ilias->db->query($query);
}
}
}
Here is the call graph for this function:| ilObjTest::saveToDb | ( | $ | properties_only = FALSE |
) |
Saves a ilObjTest object to a database.
Saves a ilObjTest object to a database (experimental)
| object | $db A pear DB object public |
Definition at line 1046 of file class.ilObjTest.php.
References $ects_fx, ilObject::$ilias, $query, $random_question_count, $result, ilObjAssessmentFolder::_enabledAssessmentLogging(), ilObjAssessmentFolder::_getLogLanguage(), isComplete(), isRandomTest(), logAction(), and saveQuestionsToDb().
Referenced by createReference().
{
global $ilias;
$db =& $ilias->db;
$complete = 0;
if ($this->isComplete()) {
$complete = 1;
}
$ects_fx = "NULL";
if (preg_match("/\d+/", $this->ects_fx))
{
$ects_fx = $this->ects_fx;
}
$random_question_count = "NULL";
if ($this->random_question_count > 0)
{
$random_question_count = $this->ilias->db->quote($this->random_question_count . "");
}
if ($this->test_id == -1) {
// Create new dataset
$now = getdate();
$created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
$query = sprintf("INSERT INTO tst_tests (test_id, obj_fi, author, test_type_fi, introduction, sequence_settings, score_reporting, nr_of_tries, processing_time, enable_processing_time, reporting_date, starting_time, ending_time, complete, ects_output, ects_a, ects_b, ects_c, ects_d, ects_e, ects_fx, random_test, random_question_count, count_system, mc_scoring, created, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
$db->quote($this->getId() . ""),
$db->quote($this->author . ""),
$db->quote($this->test_type . ""),
$db->quote($this->introduction . ""),
$db->quote($this->sequence_settings . ""),
$db->quote($this->score_reporting . ""),
$db->quote(sprintf("%d", $this->nr_of_tries) . ""),
$db->quote($this->processing_time . ""),
$db->quote("$this->enable_processing_time"),
$db->quote($this->reporting_date . ""),
$db->quote($this->starting_time . ""),
$db->quote($this->ending_time . ""),
$db->quote("$complete"),
$db->quote($this->ects_output . ""),
$db->quote($this->ects_grades["A"] . ""),
$db->quote($this->ects_grades["B"] . ""),
$db->quote($this->ects_grades["C"] . ""),
$db->quote($this->ects_grades["D"] . ""),
$db->quote($this->ects_grades["E"] . ""),
$ects_fx,
$db->quote(sprintf("%d", $this->random_test) . ""),
$random_question_count,
$db->quote($this->count_system . ""),
$db->quote($this->mc_scoring . ""),
$db->quote($created)
);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$this->logAction($this->lng->txtlng("assessment", "log_create_new_test", ilObjAssessmentFolder::_getLogLanguage()));
}
$result = $db->query($query);
if ($result == DB_OK) {
$this->test_id = $this->ilias->db->getLastInsertId();
}
} else {
// Modify existing dataset
$oldrow = array();
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$db->quote($this->test_id)
);
$result = $db->query($query);
if ($result->numRows() == 1)
{
$oldrow = $result->fetchRow(DB_FETCHMODE_ASSOC);
}
}
$query = sprintf("UPDATE tst_tests SET author = %s, test_type_fi = %s, introduction = %s, sequence_settings = %s, score_reporting = %s, nr_of_tries = %s, processing_time = %s, enable_processing_time = %s, reporting_date = %s, starting_time = %s, ending_time = %s, ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s, random_test = %s, complete = %s, count_system = %s, mc_scoring = %s WHERE test_id = %s",
$db->quote($this->author . ""),
$db->quote($this->test_type . ""),
$db->quote($this->introduction . ""),
$db->quote($this->sequence_settings . ""),
$db->quote($this->score_reporting . ""),
$db->quote(sprintf("%d", $this->nr_of_tries) . ""),
$db->quote($this->processing_time . ""),
$db->quote("$this->enable_processing_time"),
$db->quote($this->reporting_date . ""),
$db->quote($this->starting_time . ""),
$db->quote($this->ending_time . ""),
$db->quote($this->ects_output . ""),
$db->quote($this->ects_grades["A"] . ""),
$db->quote($this->ects_grades["B"] . ""),
$db->quote($this->ects_grades["C"] . ""),
$db->quote($this->ects_grades["D"] . ""),
$db->quote($this->ects_grades["E"] . ""),
$ects_fx,
$db->quote(sprintf("%d", $this->random_test) . ""),
$db->quote("$complete"),
$db->quote($this->count_system . ""),
$db->quote($this->mc_scoring . ""),
$db->quote($this->test_id)
);
$result = $db->query($query);
include_once ("./classes/class.ilObjAssessmentFolder.php");
if (ilObjAssessmentFolder::_enabledAssessmentLogging())
{
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$db->quote($this->test_id)
);
$logresult = $db->query($query);
$newrow = array();
if ($logresult->numRows() == 1)
{
$newrow = $logresult->fetchRow(DB_FETCHMODE_ASSOC);
}
$changed_fields = array();
foreach ($oldrow as $key => $value)
{
if (strcmp($oldrow[$key], $newrow[$key]) != 0)
{
array_push($changed_fields, "$key: " . $oldrow[$key] . " => " . $newrow[$key]);
}
}
$changes = join($changed_fields, ", ");
if (count($changed_fields) == 0)
{
$changes = $this->lng->txtlng("assessment", "log_no_test_fields_changed", ilObjAssessmentFolder::_getLogLanguage());
}
$this->logAction($this->lng->txtlng("assessment", "log_modified_test", ilObjAssessmentFolder::_getLogLanguage()) . " [".$changes."]");
}
}
if (!$properties_only)
{
if ($result == DB_OK) {
if (!$this->isRandomTest())
{
$this->saveQuestionsToDb();
}
$this->mark_schema->saveToDb($this->test_id);
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setActiveTestSubmitted | ( | $ | user_id | ) |
submits active test for user user_id
Definition at line 5960 of file class.ilObjTest.php.
| ilObjTest::setActiveTestUser | ( | $ | lastindex = 1, |
|
| $ | postpone = "", |
|||
| $ | addTries = false | |||
| ) |
Update the data of the tst_active table for the current user.
Update the data of the tst_active table for the current user The table saves the state of the active user in the test (sequence position, postponed questions etc.)
| integer | $lastindex The sequence position of the question the user last visited | |
| integer | $postpone The sequence position of a question which should be postponed | |
| boolean | $addTries Adds 1 to the number of test completions if set to true public |
Definition at line 2828 of file class.ilObjTest.php.
References $ilUser, $query, and getActiveTestUser().
Referenced by startWorkingTime().
{
global $ilDB;
global $ilUser;
$db =& $ilDB->db;
$old_active = $this->getActiveTestUser();
if ($old_active) {
$sequence = $old_active->sequence;
$postponed = $old_active->postponed;
if ($postpone) {
$sequence_array = split(",", $sequence);
$postpone_sequence = $sequence_array[$postpone-1];
$question_id = $this->questions[$postpone_sequence];
unset($sequence_array[$postpone-1]);
array_push($sequence_array, $postpone_sequence);
$sequence = join(",", $sequence_array);
$postponed .= ",$question_id";
$postponed = preg_replace("/^,/", "", $postponed);
}
$tries = $old_active->tries;
if ($addTries) {
$tries++;
}
$query = sprintf("UPDATE tst_active SET lastindex = %s, sequence = %s, postponed = %s, tries = %s WHERE user_fi = %s AND test_fi = %s",
$db->quote($lastindex),
$db->quote($sequence),
$db->quote($postponed),
$db->quote($tries),
$db->quote($ilUser->id),
$db->quote($this->test_id)
);
} else {
$sequence_arr = array_flip($this->questions);
$sequence = join($sequence_arr, ",");
$query = sprintf("INSERT INTO tst_active (active_id, user_fi, test_fi, sequence, postponed, lastindex, tries, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, NULL)",
$db->quote($ilUser->id),
$db->quote($this->test_id),
$db->quote($sequence),
$db->quote(""),
$db->quote($lastindex),
$db->quote(0)
);
}
$db->query($query);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::setAuthor | ( | $ | author = "" |
) |
Sets the authors name.
Sets the authors name of the ilObjTest object
| string | $author A string containing the name of the test author public |
Definition at line 1482 of file class.ilObjTest.php.
References $author.
Referenced by from_xml().
{
$this->author = $author;
}
Here is the caller graph for this function:| ilObjTest::setClientIP | ( | $ | user_id, | |
| $ | client_ip | |||
| ) |
Definition at line 5872 of file class.ilObjTest.php.
| ilObjTest::setCountSystem | ( | $ | a_count_system = COUNT_PARTIAL_SOLUTIONS |
) |
Sets the count system for the calculation of points.
Sets the count system for the calculation of points
| integer | $a_count_system The count system for the calculation of points. public |
Definition at line 1970 of file class.ilObjTest.php.
{
$this->count_system = $a_count_system;
}
| ilObjTest::setEnableProcessingTime | ( | $ | enable = 0 |
) |
Sets the processing time enabled or disabled.
Sets the processing time enabled or disabled
| integer | $enable 0 to disable the processing time, 1 to enable the processing time public |
Definition at line 1924 of file class.ilObjTest.php.
{
if ($enable) {
$this->enable_processing_time = "1";
} else {
$this->enable_processing_time = "0";
}
}
| ilObjTest::setEndingTime | ( | $ | ending_time = "" |
) |
Sets the ending time for the test.
Sets the ending time in database timestamp format for the test
| string | $ending_time The ending time for the test. Empty string for no ending time. public |
Definition at line 1956 of file class.ilObjTest.php.
References $ending_time.
Referenced by from_xml().
{
$this->ending_time = $ending_time;
}
Here is the caller graph for this function:| ilObjTest::setIntroduction | ( | $ | introduction = "" |
) |
Sets the introduction.
Sets the introduction text of the ilObjTest object
| string | $introduction An introduction string for the test public |
Definition at line 1496 of file class.ilObjTest.php.
References $introduction.
Referenced by from_xml().
{
$this->introduction = $introduction;
}
Here is the caller graph for this function:| ilObjTest::setMCScoring | ( | $ | a_mc_scoring = SCORE_ZERO_POINTS_WHEN_UNANSWERED |
) |
Sets the multiple choice scoring.
Sets the multiple choice scoring
| integer | $a_mc_scoring The scoring for multiple choice questions public |
Definition at line 1984 of file class.ilObjTest.php.
{
$this->mc_scoring = $a_mc_scoring;
}
| ilObjTest::setNrOfTries | ( | $ | nr_of_tries = 0 |
) |
Sets the nr of tries for the test.
Sets the nr of tries for the test
| integer | $nr_of_tries The maximum number of tries for the test. 0 for infinite tries. public |
Definition at line 1896 of file class.ilObjTest.php.
References $nr_of_tries.
Referenced by from_xml().
{
$this->nr_of_tries = $nr_of_tries;
}
Here is the caller graph for this function:| ilObjTest::setProcessingTime | ( | $ | processing_time = "00:00:00" |
) |
Sets the processing time for the test.
Sets the processing time for the test
| string | $processing_time The maximum processing time for the test given in hh:mm:ss public |
Definition at line 1910 of file class.ilObjTest.php.
References $processing_time.
Referenced by from_xml().
:00:00") { $this->processing_time = $processing_time; }
Here is the caller graph for this function:| ilObjTest::setQuestionSetSolved | ( | $ | value, | |
| $ | question_id, | |||
| $ | user_id | |||
| ) |
sets question solved state to value for given user_id
Definition at line 5945 of file class.ilObjTest.php.
References $query, and $user_id.
{
$query = sprintf("REPLACE INTO tst_active_qst_sol_settings SET solved=%s, question_fi=%s, test_fi=%s, user_fi=%s",
$this->ilias->db->quote($value),
$this->ilias->db->quote($question_id),
$this->ilias->db->quote($this->test_id),
$this->ilias->db->quote($user_id)
);
$this->ilias->db->query($query);
}
| ilObjTest::setRandomQuestionCount | ( | $ | a_random_question_count = "" |
) |
Sets the random question count.
Sets the random question count
| integer | $a_random_question_count The random question count public |
Definition at line 1636 of file class.ilObjTest.php.
Referenced by from_xml(), and saveRandomQuestionCount().
{
$this->random_question_count = $a_random_question_count;
}
Here is the caller graph for this function:| ilObjTest::setRandomTest | ( | $ | a_random_test = 0 |
) |
Sets the random test indicator.
Sets the random test indicator
| integer | $a_random_test The random test indicator (0 = no random test, 1 = random test) public |
Definition at line 1622 of file class.ilObjTest.php.
Referenced by from_xml().
{
$this->random_test = $a_random_test;
}
Here is the caller graph for this function:| ilObjTest::setReportingDate | ( | $ | reporting_date | ) |
Sets the reporting date.
Sets the reporting date of the ilObjTest object
| timestamp | $reporting_date The date and time the score reporting is available public |
Definition at line 1650 of file class.ilObjTest.php.
References $reporting_date.
Referenced by from_xml().
{
if (!$reporting_date)
{
$this->reporting_date = "";
$this->ects_output = 0;
}
else
{
$this->reporting_date = $reporting_date;
$this->score_reporting = REPORT_AFTER_TEST;
}
}
Here is the caller graph for this function:| ilObjTest::setScoreReporting | ( | $ | score_reporting = 0 |
) |
Sets the score reporting.
Sets the score reporting of the ilObjTest object
| integer | $score_reporting The score reporting public |
Definition at line 1608 of file class.ilObjTest.php.
References $score_reporting.
Referenced by from_xml().
{
$this->score_reporting = $score_reporting;
}
Here is the caller graph for this function:| ilObjTest::setSequenceSettings | ( | $ | sequence_settings = 0 |
) |
Sets the sequence settings.
Sets the sequence settings of the ilObjTest object
| integer | $sequence_settings The sequence settings public |
Definition at line 1580 of file class.ilObjTest.php.
References $sequence_settings.
Referenced by from_xml().
{
$this->sequence_settings = $sequence_settings;
}
Here is the caller graph for this function:| ilObjTest::setStartingTime | ( | $ | starting_time = "" |
) |
Sets the starting time for the test.
Sets the starting time in database timestamp format for the test
| string | $starting_time The starting time for the test. Empty string for no starting time. public |
Definition at line 1942 of file class.ilObjTest.php.
References $starting_time.
Referenced by from_xml().
{
$this->starting_time = $starting_time;
}
Here is the caller graph for this function:| ilObjTest::setTestType | ( | $ | type = TYPE_ASSESSMENT |
) |
Sets the test type.
Sets the type of the ilObjTest object
| integer | $type The test type value public |
Definition at line 1594 of file class.ilObjTest.php.
References ilObject::$type.
Referenced by from_xml(), and importObject().
{
$this->test_type = $type;
}
Here is the caller graph for this function:| ilObjTest::startingTimeReached | ( | ) |
Returns true if the starting time of a test is reached.
Returns true if the starting time of a test is reached A starting time is not available for self assessment tests
Definition at line 4028 of file class.ilObjTest.php.
References getStartingTime(), and getTestType().
{
if ($this->getTestType() == TYPE_ASSESSMENT || $this->getTestType() == TYPE_ONLINE_TEST)
{
if ($this->getStartingTime())
{
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartingTime(), $matches);
$epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = mktime();
if ($now < $epoch_time)
{
// starting time not reached
return false;
}
}
}
return true;
}
Here is the call graph for this function:| ilObjTest::startWorkingTime | ( | $ | user_id | ) |
Write the initial entry for the tests working time to the database.
Write the initial entry for the tests working time to the database
| integer | $user_id The database id of the user working with the test public |
Definition at line 2507 of file class.ilObjTest.php.
References $q, $result, $user_id, getActiveTestUser(), and setActiveTestUser().
{
$result = "";
if (!($result = $this->getActiveTestUser($user_id))) {
$this->setActiveTestUser();
$result = $this->getActiveTestUser($user_id);
}
$q = sprintf("INSERT INTO tst_times (times_id, active_fi, started, finished, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
$this->ilias->db->quote($result->active_id),
$this->ilias->db->quote(strftime("%Y-%m-%d %H:%M:%S")),
$this->ilias->db->quote(strftime("%Y-%m-%d %H:%M:%S"))
);
$result = $this->ilias->db->query($q);
return $this->ilias->db->getLastInsertId();
}
Here is the call graph for this function:| ilObjTest::testTitleExists | ( | $ | title | ) |
Returns TRUE if the test title exists in the database.
Returns TRUE if the test title exists in the database
| string | $title The title of the test |
Definition at line 876 of file class.ilObjTest.php.
References $query, $result, and ilObject::$title.
Referenced by duplicate().
{
$query = sprintf("SELECT * FROM object_data WHERE title = %s AND type = %s",
$this->ilias->db->quote($title),
$this->ilias->db->quote("tst")
);
$result = $this->ilias->db->query($query);
if (strcmp(strtolower(get_class($result)), db_result) == 0) {
if ($result->numRows() == 1) {
return TRUE;
}
}
return FALSE;
}
Here is the caller graph for this function:| ilObjTest::to_xml | ( | ) |
Returns a QTI xml representation of the test.
Returns a QTI xml representation of the test
Definition at line 4285 of file class.ilObjTest.php.
References $score_reporting, $xml, _instanciateQuestion(), domxml_open_mem(), getAuthor(), getCountSystem(), ilObject::getDescription(), getEndingTime(), getIntroduction(), getMCScoring(), getNrOfTries(), getRandomQuestionCount(), getReportingDate(), getScoreReporting(), getSequenceSettings(), getStartingTime(), getTestType(), ilObject::getTitle(), and isRandomTest().
Referenced by importObject().
{
$xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<questestinterop></questestinterop>\n";
$domxml = domxml_open_mem($xml_header);
$root = $domxml->document_element();
// qti assessment
$qtiAssessment = $domxml->create_element("assessment");
$qtiAssessment->set_attribute("ident", "il_".IL_INST_ID."_tst_".$this->getTestId());
$qtiAssessment->set_attribute("title", $this->getTitle());
// add qti comment
$qtiComment = $domxml->create_element("qticomment");
$qtiCommentText = $domxml->create_text_node($this->getDescription());
$qtiComment->append_child($qtiCommentText);
$qtiAssessment->append_child($qtiComment);
// add qti duration
if ($this->enable_processing_time)
{
$qtiDuration = $domxml->create_element("duration");
preg_match("/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
$qtiDurationText = $domxml->create_text_node(sprintf("P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
$qtiDuration->append_child($qtiDurationText);
$qtiAssessment->append_child($qtiDuration);
}
// add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
$qtiMetadata = $domxml->create_element("qtimetadata");
// ILIAS version
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("ILIAS_VERSION");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node($this->ilias->getSetting("ilias_version"));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// test type
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("test_type");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("%d", $this->getTestType()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// sequence settings
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("sequence_settings");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("%d", $this->getSequenceSettings()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// author
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("author");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node($this->getAuthor());
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// count system
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("count_system");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node($this->getCountSystem());
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// multiple choice scoring
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("mc_scoring");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node($this->getMCScoring());
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// score reporting date
if ($this->getReportingDate())
{
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("reporting_date");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
$qtiFieldEntryText = $domxml->create_text_node(sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
}
// number of tries
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("nr_of_tries");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("%d", $this->getNrOfTries()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// random test
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("random_test");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("%d", $this->isRandomTest()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// random question count
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("random_question_count");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("%d", $this->getRandomQuestionCount()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
// starting time
if ($this->getStartingTime())
{
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("starting_time");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
$qtiFieldEntryText = $domxml->create_text_node(sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
}
// ending time
if ($this->getEndingTime())
{
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("ending_time");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
$qtiFieldEntryText = $domxml->create_text_node(sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
}
foreach ($this->mark_schema->mark_steps as $index => $mark)
{
// mark steps
$qtiMetadatafield = $domxml->create_element("qtimetadatafield");
$qtiFieldLabel = $domxml->create_element("fieldlabel");
$qtiFieldLabelText = $domxml->create_text_node("mark_step_$index");
$qtiFieldLabel->append_child($qtiFieldLabelText);
$qtiFieldEntry = $domxml->create_element("fieldentry");
$qtiFieldEntryText = $domxml->create_text_node(sprintf("<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>", $mark->get_short_name(), $mark->get_official_name(), $mark->get_minimum_level(), $mark->get_passed()));
$qtiFieldEntry->append_child($qtiFieldEntryText);
$qtiMetadatafield->append_child($qtiFieldLabel);
$qtiMetadatafield->append_child($qtiFieldEntry);
$qtiMetadata->append_child($qtiMetadatafield);
}
$qtiAssessment->append_child($qtiMetadata);
// add qti objectives
$qtiObjectives = $domxml->create_element("objectives");
$qtiMaterial = $domxml->create_element("material");
$qtiMaterial->set_attribute("label", "introduction");
$qtiMatText = $domxml->create_element("mattext");
$qtiMatTextText = $domxml->create_text_node($this->getIntroduction());
$qtiMatText->append_child($qtiMatTextText);
$qtiMaterial->append_child($qtiMatText);
$qtiObjectives->append_child($qtiMaterial);
$qtiAssessment->append_child($qtiObjectives);
// add qti assessmentcontrol
$qtiAssessmentcontrol = $domxml->create_element("assessmentcontrol");
$score_reporting = "No";
switch ($this->getScoreReporting())
{
case "1":
$score_reporting = "Yes";
break;
}
$qtiAssessmentcontrol->set_attribute("solutionswitch", $score_reporting);
$qtiAssessment->append_child($qtiAssessmentcontrol);
$qtiSection = $domxml->create_element("section");
$qtiSection->set_attribute("ident", "1");
$qtiAssessment->append_child($qtiSection);
$root->append_child($qtiAssessment);
$xml = $domxml->dump_mem(true);
$domxml->free();
foreach ($this->questions as $question_id) {
$question =& ilObjTest::_instanciateQuestion($question_id);
$qti_question = $question->to_xml(false);
$qti_question = preg_replace("/<questestinterop>/", "", $qti_question);
$qti_question = preg_replace("/<\/questestinterop>/", "", $qti_question);
if (strpos($xml, "</section>") !== false)
{
$xml = str_replace("</section>", "$qti_question</section>", $xml);
}
else
{
$xml = str_replace("<section ident=\"1\"/>", "<section ident=\"1\">\n$qti_question</section>", $xml);
}
}
return $xml;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::update | ( | ) |
update object data
public
Reimplemented from ilObject.
Definition at line 384 of file class.ilObjTest.php.
References updateMetaData().
{
$this->updateMetaData();
if (!parent::update())
{
return false;
}
// put here object specific stuff
return true;
}
Here is the call graph for this function:| ilObjTest::updateMetaData | ( | ) |
update meta data entry
Reimplemented from ilObject.
Definition at line 5094 of file class.ilObjTest.php.
References $ilUser, ilObject::getId(), ilObject::getTitle(), and ilObject::getType().
Referenced by update().
{
global $ilUser;
include_once("Services/MetaData/classes/class.ilMD.php");
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_gen =& $md->getGeneral();
if ($md_gen == false)
{
include_once 'Services/MetaData/classes/class.ilMDCreator.php';
$md_creator = new ilMDCreator($this->getId(),0,$this->getType());
$md_creator->setTitle($this->getTitle());
$md_creator->setTitleLanguage($ilUser->getPref('language'));
$md_creator->create();
}
parent::updateMetaData();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjTest::updateWorkingTime | ( | $ | times_id | ) |
Update the working time of a test when a question is answered.
Update the working time of a test when a question is answered
| integer | $times_id The database id of a working time entry public |
Definition at line 2531 of file class.ilObjTest.php.
| ilObjTest::$author |
Definition at line 98 of file class.ilObjTest.php.
Referenced by setAuthor().
| ilObjTest::$count_system |
Definition at line 302 of file class.ilObjTest.php.
| ilObjTest::$ects_fx |
Definition at line 253 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$ects_grades |
Definition at line 274 of file class.ilObjTest.php.
| ilObjTest::$ects_output |
Definition at line 244 of file class.ilObjTest.php.
Referenced by saveECTSStatus().
| ilObjTest::$enable_processing_time |
Definition at line 217 of file class.ilObjTest.php.
| ilObjTest::$ending_time |
Definition at line 235 of file class.ilObjTest.php.
Referenced by setEndingTime().
| ilObjTest::$evaluation_data |
Definition at line 180 of file class.ilObjTest.php.
| ilObjTest::$introduction |
Definition at line 126 of file class.ilObjTest.php.
Referenced by setIntroduction().
| ilObjTest::$invitation = INVITATION_OFF |
Definition at line 87 of file class.ilObjTest.php.
| ilObjTest::$mark_schema |
Definition at line 135 of file class.ilObjTest.php.
| ilObjTest::$mc_scoring |
Definition at line 309 of file class.ilObjTest.php.
| ilObjTest::$metadata |
Definition at line 107 of file class.ilObjTest.php.
| ilObjTest::$nr_of_tries |
Definition at line 199 of file class.ilObjTest.php.
Referenced by setNrOfTries().
| ilObjTest::$processing_time |
Definition at line 208 of file class.ilObjTest.php.
Referenced by isMaxProcessingTimeReached(), and setProcessingTime().
| ilObjTest::$questions |
Definition at line 116 of file class.ilObjTest.php.
| ilObjTest::$random_question_count |
Definition at line 294 of file class.ilObjTest.php.
Referenced by saveToDb().
| ilObjTest::$random_test |
Definition at line 285 of file class.ilObjTest.php.
| ilObjTest::$reporting_date |
Definition at line 171 of file class.ilObjTest.php.
Referenced by setReportingDate().
| ilObjTest::$score_reporting |
Definition at line 159 of file class.ilObjTest.php.
Referenced by from_xml(), setScoreReporting(), and to_xml().
| ilObjTest::$sequence_settings |
Definition at line 146 of file class.ilObjTest.php.
Referenced by setSequenceSettings().
| ilObjTest::$starting_time |
Definition at line 226 of file class.ilObjTest.php.
Referenced by isMaxProcessingTimeReached(), and setStartingTime().
| ilObjTest::$test_id |
Definition at line 78 of file class.ilObjTest.php.
Referenced by _getActiveTestUser(), _getCountSystem(), _getObjectIDFromTestID(), _getTestIDFromObjectID(), and _getTestType().
| ilObjTest::$test_type |
Definition at line 189 of file class.ilObjTest.php.
| ilObjTest::$test_types |
Definition at line 265 of file class.ilObjTest.php.
1.7.1