本文整理汇总了PHP中ilObjTest::getTestId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::getTestId方法的具体用法?PHP ilObjTest::getTestId怎么用?PHP ilObjTest::getTestId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::getTestId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSession
/**
* creates and returns an instance of a test sequence
* that corresponds to the current test mode
*
* @param integer $activeId
* @return ilTestSession|ilTestSessionDynamicQuestionSet
*/
public function getSession($activeId = null)
{
global $ilUser;
if (self::$testSession === null) {
switch ($this->testOBJ->getQuestionSetType()) {
case ilObjTest::QUESTION_SET_TYPE_FIXED:
case ilObjTest::QUESTION_SET_TYPE_RANDOM:
global $ilUser;
require_once 'Modules/Test/classes/class.ilTestSession.php';
self::$testSession = new ilTestSession();
break;
case ilObjTest::QUESTION_SET_TYPE_DYNAMIC:
require_once 'Modules/Test/classes/class.ilTestSessionDynamicQuestionSet.php';
self::$testSession = new ilTestSessionDynamicQuestionSet();
break;
}
self::$testSession->setRefId($this->testOBJ->getRefId());
self::$testSession->setTestId($this->testOBJ->getTestId());
if ($activeId) {
self::$testSession->loadFromDb($activeId);
} else {
self::$testSession->loadTestSession($this->testOBJ->getTestId(), $ilUser->getId(), $_SESSION["tst_access_code"][$this->testOBJ->getTestId()]);
}
}
return self::$testSession;
}
示例2: __construct
public function __construct(ilDB $db, ilObjTest $testOBJ)
{
$this->db = $db;
$this->testOBJ = $testOBJ;
$this->skillQuestionAssignmentList = new ilTestSkillQuestionAssignmentList($this->db);
$this->skillQuestionAssignmentList->setTestId($this->testOBJ->getTestId());
$this->skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
$this->skillLevelThresholdList->setTestId($this->testOBJ->getTestId());
$this->questions = array();
$this->maxPointsByQuestion = array();
}
示例3: getQuestionIdsForSourcePoolDefinitionIds
private function getQuestionIdsForSourcePoolDefinitionIds(ilTestRandomQuestionSetSourcePoolDefinition $definition)
{
$this->stagingPoolQuestionList->resetQuestionList();
$this->stagingPoolQuestionList->setTestObjId($this->testOBJ->getId());
$this->stagingPoolQuestionList->setTestId($this->testOBJ->getTestId());
$this->stagingPoolQuestionList->setPoolId($definition->getPoolId());
if ($this->hasTaxonomyFilter($definition)) {
$this->stagingPoolQuestionList->addTaxonomyFilter($definition->getMappedFilterTaxId(), array($definition->getMappedFilterTaxNodeId()));
}
$this->stagingPoolQuestionList->loadQuestions();
return $this->stagingPoolQuestionList->getQuestions();
}
示例4: stageQuestionsFromSourcePool
private function stageQuestionsFromSourcePool($sourcePoolId)
{
$questionIdMapping = array();
$query = 'SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND complete = %s AND original_id IS NULL';
$res = $this->db->queryF($query, array('integer', 'text'), array($sourcePoolId, 1));
while ($row = $this->db->fetchAssoc($res)) {
$question = assQuestion::_instanciateQuestion($row['question_id']);
$duplicateId = $question->duplicate(true, null, null, null, $this->testOBJ->getId());
$nextId = $this->db->nextId('tst_rnd_cpy');
$this->db->insert('tst_rnd_cpy', array('copy_id' => array('integer', $nextId), 'tst_fi' => array('integer', $this->testOBJ->getTestId()), 'qst_fi' => array('integer', $duplicateId), 'qpl_fi' => array('integer', $sourcePoolId)));
$questionIdMapping[$row['question_id']] = $duplicateId;
}
return $questionIdMapping;
}
示例5: buildSkillQuestionAssignmentList
private function buildSkillQuestionAssignmentList()
{
require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignmentList.php';
$assignmentList = new ilTestSkillQuestionAssignmentList($this->db);
$assignmentList->setTestId($this->testOBJ->getTestId());
return $assignmentList;
}
示例6: executeCommand
public function executeCommand()
{
if ($this->isAccessDenied()) {
$this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
}
$nextClass = $this->ctrl->getNextClass();
$this->manageTabs($nextClass);
switch ($nextClass) {
case 'ilassquestionskillassignmentsgui':
$questionContainerId = $this->getQuestionContainerId();
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
$questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
$questionList->setParentObjId($questionContainerId);
$questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
$questionList->load();
$gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
$gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
$gui->setQuestionContainerId($questionContainerId);
$gui->setQuestionList($questionList);
if ($this->testOBJ->isFixedTest()) {
$gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
} else {
$gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
}
$this->ctrl->forwardCommand($gui);
break;
case 'iltestskilllevelthresholdsgui':
$gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
$gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
$gui->setQuestionContainerId($this->getQuestionContainerId());
$this->ctrl->forwardCommand($gui);
break;
}
}
示例7: savedDefinitionsExist
/**
* @return bool
*/
public function savedDefinitionsExist()
{
$query = "SELECT COUNT(*) cnt FROM tst_rnd_quest_set_qpls WHERE test_fi = %s";
$res = $this->db->queryF($query, array('integer'), array($this->testOBJ->getTestId()));
$row = $this->db->fetchAssoc($res);
return $row['cnt'] > 0;
}
示例8: areSkillLevelThresholdsMissing
private function areSkillLevelThresholdsMissing()
{
if ($this->object->isDynamicTest()) {
$questionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
$questionContainerId = $questionSetConfig->getSourceQuestionPoolId();
} else {
$questionContainerId = $this->object->getId();
}
global $ilDB;
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
require_once 'Modules/Test/classes/class.ilTestSkillLevelThreshold.php';
$assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
$assignmentList->setParentObjId($questionContainerId);
$assignmentList->loadFromDb();
foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
foreach ($data['skill']->getLevelData() as $level) {
$treshold = new ilTestSkillLevelThreshold($ilDB);
$treshold->setTestId($this->object->getTestId());
$treshold->setSkillBaseId($data['skill_base_id']);
$treshold->setSkillTrefId($data['skill_tref_id']);
$treshold->setSkillLevelId($level['id']);
if (!$treshold->dbRecordExists()) {
return true;
}
}
}
return false;
}
示例9: buildSkillLevelThresholdList
private function buildSkillLevelThresholdList()
{
require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
$thresholdList = new ilTestSkillLevelThresholdList($this->db);
$thresholdList->setTestId($this->testOBJ->getTestId());
return $thresholdList;
}
示例10: buildForm
/**
* builds the question set config form and initialises the fields
* with the config currently saved in database
*
* @return ilPropertyFormGUI $form
*/
private function buildForm()
{
$this->questionSetConfig->loadFromDb($this->testOBJ->getTestId());
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setId("tst_form_dynamic_question_set_config");
$form->setTitle($this->lng->txt('tst_form_dynamic_question_set_config'));
$form->setTableWidth("100%");
$hiddenInputTaxSelectOptAsyncUrl = new ilHiddenInputGUI('taxSelectOptAsyncUrl');
$hiddenInputTaxSelectOptAsyncUrl->setValue($this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC, '', true));
$form->addItem($hiddenInputTaxSelectOptAsyncUrl);
if ($this->testOBJ->participantDataExist()) {
$pool = new ilNonEditableValueGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_title');
$pool->setValue($this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree));
$pool->setDisabled(true);
$form->addItem($pool);
} else {
$poolInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_id');
$poolInput->setOptions($this->buildQuestionPoolSelectInputOptionArray($this->testOBJ->getAvailableQuestionpools(true, false, false, true, true)));
$poolInput->setValue($this->questionSetConfig->getSourceQuestionPoolId());
$poolInput->setRequired(true);
$form->addItem($poolInput);
}
$questionOderingInput = new ilRadioGroupInputGUI($this->lng->txt('tst_input_dynamic_question_set_question_ordering'), 'question_ordering');
$questionOderingInput->setValue($this->questionSetConfig->getOrderingTaxonomyId() ? self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE);
$optionOrderByDate = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_date'), self::QUESTION_ORDERING_TYPE_UPDATE_DATE, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_date_desc'));
$questionOderingInput->addOption($optionOrderByDate);
$optionOrderByTax = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_tax'), self::QUESTION_ORDERING_TYPE_TAXONOMY, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_tax_desc'));
$orderTaxInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_ordering_tax'), 'ordering_tax');
$orderTaxInput->setInfo($this->lng->txt('tst_input_dynamic_question_set_ordering_tax_description'));
$orderTaxInput->setValue($this->questionSetConfig->getOrderingTaxonomyId());
$orderTaxInput->setRequired(true);
$orderTaxInput->setOptions($this->buildTaxonomySelectInputOptionArray($this->questionSetConfig->getSourceQuestionPoolId()));
$optionOrderByTax->addSubItem($orderTaxInput);
$questionOderingInput->addOption($optionOrderByTax);
$form->addItem($questionOderingInput);
$taxFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dynamic_question_set_taxonomie_filter_enabled'), 'tax_filter_enabled');
$taxFilterInput->setValue(1);
$taxFilterInput->setChecked($this->questionSetConfig->isTaxonomyFilterEnabled());
$form->addItem($taxFilterInput);
$answStatusFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_answer_status_filter_enabled'), 'answer_status_filter_enabled');
$answStatusFilterInput->setValue(1);
$answStatusFilterInput->setChecked($this->questionSetConfig->isAnswerStatusFilterEnabled());
$form->addItem($answStatusFilterInput);
$previousQuestionsListInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_prev_quest_list_enabled'), 'prev_quest_list_enabled');
$previousQuestionsListInput->setValue(1);
$previousQuestionsListInput->setChecked($this->questionSetConfig->isPreviousQuestionsListEnabled());
$form->addItem($previousQuestionsListInput);
if ($this->testOBJ->participantDataExist()) {
$questionOderingInput->setDisabled(true);
$taxFilterInput->setDisabled(true);
$answStatusFilterInput->setDisabled(true);
$previousQuestionsListInput->setDisabled(true);
} else {
$form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save'));
}
return $form;
}
示例11: saveToDb
public function saveToDb()
{
if ($this->getId()) {
$this->updateDbRecord($this->testOBJ->getTestId());
} else {
$this->insertDbRecord($this->testOBJ->getTestId());
}
}
示例12: save
public function save()
{
$this->questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired($this->getItemByPostVar('quest_points_equal_per_pool')->getChecked());
switch ($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()) {
case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST:
$this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue());
$this->questionSetConfig->setQuestionAmountPerTest($this->getItemByPostVar('quest_amount_per_test')->getValue());
break;
case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL:
$this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue());
$this->questionSetConfig->setQuestionAmountPerTest(null);
break;
}
return $this->questionSetConfig->saveToDb($this->testOBJ->getTestId());
}
示例13: questionsObject
protected function questionsObject()
{
/** @var $ilAccess ilAccessHandler */
global $ilAccess;
if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
// allow only write access
ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirect($this, "infoScreen");
}
if ($_GET['browse']) {
exit('Browse??');
return $this->object->questionbrowser();
}
if ($_GET["eqid"] && $_GET["eqpl"]) {
$this->ctrl->setParameter($this, 'q_id', $_GET["eqid"]);
$this->ctrl->setParameter($this, 'qpl_id', $_GET["eqpl"]);
$this->ctrl->redirect($this, 'adjustscoringfortest');
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
$this->tpl->setCurrentBlock("adm_content");
include_once "./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
$checked_move = is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()]) && count($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
$table_gui = new ilTestQuestionsTableGUI($this, 'showquestionlist', $ilAccess->checkAccess("write", "", $this->ref_id) ? true : false, $checked_move, 0);
$data = $this->object->getTestQuestions();
// @TODO Ask object for random test.
if (!$data) {
$this->object->getPotentialRandomTestQuestions();
}
$filtered_data = array();
foreach ($data as $question) {
$question_object = assQuestion::instantiateQuestionGUI($question['question_id']);
if ($this->supportsAdjustment($question_object) && $this->allowedInAdjustment($question_object)) {
$filtered_data[] = $question;
}
}
$table_gui->setData($filtered_data);
$table_gui->clearActionButtons();
$table_gui->clearCommandButtons();
$table_gui->multi = array();
$table_gui->setRowTemplate('tpl.il_as_tst_adjust_questions_row.html', 'Modules/Test');
$table_gui->header_commands = array();
$table_gui->setSelectAllCheckbox(null);
$this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML());
$this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this, 'showquestionlist'));
$this->tpl->parseCurrentBlock();
}
示例14: getCorrectSolutionOutput
/**
* Returns an output of the solution to an answer compared to the correct solution
*
* @param integer $question_id Database ID of the question
* @param integer $active_id Active ID of the active user
* @param integer $pass Test pass
* @return string HTML code of the correct solution comparison
* @access public
*/
function getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList = null)
{
global $ilUser;
$test_id = $this->object->getTestId();
$question_gui = $this->object->createQuestionGUI("", $question_id);
$template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test");
$show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE;
$result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE);
$best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE);
if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') {
$specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, $pass);
if (strlen($specificAnswerFeedback)) {
$template->setCurrentBlock("outline_specific_feedback");
$template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
$template->parseCurrentBlock();
}
}
if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
$template->setCurrentBlock("best_solution");
$template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
$template->setVariable("BEST_OUTPUT", $best_output);
$template->parseCurrentBlock();
}
$template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
$maxpoints = $question_gui->object->getMaximumPoints();
if ($maxpoints == 1) {
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
} else {
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
}
if ($objectivesList !== null) {
$objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
$objectives .= $objectivesList->getQuestionRelatedObjectiveTitle($question_gui->object->getId());
$template->setVariable('OBJECTIVES', $objectives);
}
$template->setVariable("SOLUTION_OUTPUT", $result_output);
$template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
$template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
return $template->get();
}
示例15: buildExportFileXML
/**
* build xml export file
*/
function buildExportFileXML()
{
global $ilBench;
$ilBench->start("TestExport", "buildExportFile");
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$this->xml = new ilXmlWriter();
// set dtd definition
$this->xml->xmlSetDtdDef("<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
// set generated comment
$this->xml->xmlSetGenCmt("Export of ILIAS Test " . $this->test_obj->getId() . " of installation " . $this->inst . ".");
// set xml header
$this->xml->xmlHeader();
// create directories
$this->test_obj->createExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
// get Log File
$expDir = $this->test_obj->getExportDirectory();
include_once "./Services/Logging/classes/class.ilLog.php";
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// write qti file
$qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->qti_filename, "w");
fwrite($qti_file, $this->test_obj->toXML());
fclose($qti_file);
// get xml content
$ilBench->start("TestExport", "buildExportFile_getXML");
$this->test_obj->exportPagesXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog);
$ilBench->stop("TestExport", "buildExportFile_getXML");
// dump xml document to screen (only for debugging reasons)
/*
echo "<PRE>";
echo htmlentities($this->xml->xmlDumpMem($format));
echo "</PRE>";
*/
// dump xml document to file
$ilBench->start("TestExport", "buildExportFile_dumpToFile");
$this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
$ilBench->stop("TestExport", "buildExportFile_dumpToFile");
if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php")) {
// dump results xml document to file
include_once "./Modules/Test/classes/class.ilTestResultsToXML.php";
$resultwriter = new ilTestResultsToXML($this->test_obj->getTestId(), $this->test_obj->getAnonymity());
$ilBench->start("TestExport", "buildExportFile_results");
$resultwriter->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->resultsfile, false);
$ilBench->stop("TestExport", "buildExportFile_results");
}
// add media objects which were added with tiny mce
$ilBench->start("QuestionpoolExport", "buildExportFile_saveAdditionalMobs");
$this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir);
$ilBench->stop("QuestionpoolExport", "buildExportFile_saveAdditionalMobs");
// zip the file
$ilBench->start("TestExport", "buildExportFile_zipFile");
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
$ilBench->stop("TestExport", "buildExportFile_zipFile");
// destroy writer object
$this->xml->_XmlWriter;
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("TestExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}