本文整理汇总了PHP中ilObjTest类的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest类的具体用法?PHP ilObjTest怎么用?PHP ilObjTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilObjTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSequenceByActiveIdAndPass
/**
* creates and returns an instance of a test sequence
* that corresponds to the current test mode and given active/pass
*
* @param integer $activeId
* @param integer $pass
* @return ilTestSequenceFixedQuestionSet|ilTestSequenceRandomQuestionSet|ilTestSequenceDynamicQuestionSet
*/
public function getSequenceByActiveIdAndPass($activeId, $pass)
{
if ($this->testSequences[$activeId][$pass] === null) {
switch ($this->testOBJ->getQuestionSetType()) {
case ilObjTest::QUESTION_SET_TYPE_FIXED:
require_once 'Modules/Test/classes/class.ilTestSequenceFixedQuestionSet.php';
$this->testSequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet($activeId, $pass, $this->testOBJ->isRandomTest());
break;
case ilObjTest::QUESTION_SET_TYPE_RANDOM:
require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php';
$this->testSequences[$activeId][$pass] = new ilTestSequenceRandomQuestionSet($activeId, $pass, $this->testOBJ->isRandomTest());
break;
case ilObjTest::QUESTION_SET_TYPE_DYNAMIC:
require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php';
require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php';
$questionSet = new ilTestDynamicQuestionSet($this->db, $this->lng, $this->pluginAdmin, $this->testOBJ);
$this->testSequences[$activeId][$pass] = new ilTestSequenceDynamicQuestionSet($this->db, $questionSet, $activeId);
#$this->testSequence->setPreventCheckedQuestionsFromComingUpEnabled(
# $this->testOBJ->isInstantFeedbackAnswerFixationEnabled()
#); // checked questions now has to come up any time, so they can be set to unchecked right at this moment
break;
}
}
return $this->testSequences[$activeId][$pass];
}
示例2: _getCurrentConfig
/**
* Get the configuration that should be used for the current selector
* @param object (optional) current running test
* @return ilCharSelectorConfig
*/
static function _getCurrentConfig(ilObjTest $a_test_obj = null)
{
global $ilSetting, $ilUser;
// check configuration from administration settings
$admin_config = new self(self::CONTEXT_ADMIN, true);
$admin_config->setAvailability($ilSetting->get('char_selector_availability'));
$admin_config->setDefinition($ilSetting->get('char_selector_definition'));
if ($admin_config->getAvailability() == self::INACTIVE) {
// a globally inactive selector can't be overwritten by users or tests
return $admin_config;
}
// a test configuration is relevant for test runs
if (isset($a_test_obj)) {
$test_config = new self(self::CONTEXT_TEST, false);
$test_config->setAvailability($a_test_obj->getCharSelectorAvailability());
$test_config->setDefinition($a_test_obj->getCharSelectorDefinition());
if ($test_config->getAvailability() != self::INHERIT) {
// a specific test configuration has precedence over user configuration
return $test_config;
}
}
// check configuration from user settings
$user_config = new self(self::CONTEXT_USER, true);
$user_config->setAvailability($ilUser->getPref('char_selector_availability'));
$user_config->setDefinition($ilUser->getPref('char_selector_definition'));
if ($user_config->getAvailability() != self::INHERIT) {
// take user specific config
return $user_config;
} else {
// take admin config as default
return $admin_config;
}
}
示例3: __construct
public function __construct(ilObjTest $testOBJ)
{
$this->testOBJ = $testOBJ;
$templateId = $this->testOBJ->getTemplate();
if ($templateId) {
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$this->settingsTemplate = new ilSettingsTemplate($templateId, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
}
}
示例4: getPlayerGUI
/**
* creates and returns an instance of a player gui
* that corresponds to the current test mode
*
* @return ilTestPlayerAbstractGUI
*/
public function getPlayerGUI()
{
switch ($this->testOBJ->getQuestionSetType()) {
case ilObjTest::QUESTION_SET_TYPE_FIXED:
case ilObjTest::QUESTION_SET_TYPE_RANDOM:
require_once 'Modules/Test/classes/class.ilTestOutputGUI.php';
return new ilTestOutputGUI($this->testOBJ);
case ilObjTest::QUESTION_SET_TYPE_DYNAMIC:
require_once 'Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php';
return new ilTestPlayerDynamicQuestionSetGUI($this->testOBJ);
}
}
示例5: prevQuestion
public function prevQuestion()
{
$obj = new ilObjTest($_REQUEST['ref_id']);
$questions = array_keys($obj->getQuestionTitlesAndIndexes());
$pos = array_search($_REQUEST['q_id'], $questions);
if ($pos !== false) {
$next = $questions[$pos - 1];
} else {
$next = $questions[0];
}
$this->ctrl->setParameter($this, 'q_id', $next);
$link = $this->ctrl->getLinkTarget($this, 'edit', '', '', false);
ilUtil::redirect($link);
}
示例6: getItems
/**
* Get all completed tests
*/
protected function getItems()
{
global $ilUser;
include_once "Modules/Test/classes/class.ilObjTest.php";
$data = array();
foreach (ilObjTest::_lookupFinishedUserTests($ilUser->getId()) as $test_id => $passed) {
// #11210 - only available certificates!
$test = new ilObjTest($test_id, false);
$active_id = $test->getActiveIdOfUser($ilUser->getId());
if ($test->canShowCertificate($ilUser->getId(), $active_id)) {
$data[] = array("id" => $test_id, "title" => ilObject::_lookupTitle($test_id), "passed" => $passed);
}
}
$this->setData($data);
}
示例7: getItems
/**
* Get all completed tests
*/
protected function getItems()
{
global $ilUser;
include_once "Modules/Test/classes/class.ilObjTest.php";
include_once "Modules/Test/classes/class.ilTestSessionFactory.php";
$data = array();
foreach (ilObjTest::getTestObjIdsWithActiveForUserId($ilUser->getId()) as $test_id) {
// #11210 - only available certificates!
$test = new ilObjTest($test_id, false);
$session = new ilTestSessionFactory($test);
$session = $session->getSession(null);
if ($test->canShowCertificate($session, $session->getUserId(), $session->getActiveId())) {
$data[] = array("id" => $test_id, "title" => $test->getTitle(), "passed" => $test->getPassed($session->getActiveId()));
}
}
$this->setData($data);
}
示例8: getPathname
/**
* @param string $extension
* @param string $additional
* @return string
* @throws ilException
*/
public function getPathname($extension, $additional = '')
{
if (!is_string($extension) || !strlen($extension)) {
throw new ilException('Missing file extension! Please pass a file extension of type string.');
} else {
if (substr_count($extension, '.') > 1 || strpos($extension, '.') !== false && strpos($extension, '.') !== 0) {
throw new ilException('Please use at most one dot in your file extension.');
} else {
if (strpos($extension, '.') === 0) {
$extension = substr($extension, 1);
}
}
}
if (!is_string($additional)) {
} else {
if (strlen($additional)) {
if (strpos($additional, '__') === 0) {
throw new ilException('The additional file part may not contain __ at the beginning!');
}
$additional = '__' . $additional . '_';
} else {
$additional = '_';
}
}
return $this->test->getExportDirectory() . DIRECTORY_SEPARATOR . $this->getTimestamp() . '__' . IL_INST_ID . '__' . $this->test->getType() . $additional . $this->test->getId() . '.' . $extension;
}
示例9: loadResultData
private function loadResultData()
{
$this->resultData = $this->testOBJ->getResultsForActiveId($this->getActiveId());
if ($this->testOBJ->getECTSOutput()) {
$ectsMark = $this->testOBJ->getECTSGrade($this->testOBJ->getTotalPointsPassedArray(), $this->resultData['reached_points'], $this->resultData['max_points']);
$this->resultData['ects_grade'] = $this->lng->txt('ects_grade_' . strtolower($ectsMark));
}
}
示例10: getHTML
public function getHTML()
{
$gui = new ilPersonalSkillsGUI();
$gui->setGapAnalysisActualStatusModePerObject($this->testOBJ->getId(), $this->lng->txt('tst_test_result'));
$gui->setProfileId($this->getSelectedSkillProfile());
$html = $gui->getGapAnalysisHTML($this->getUsrId(), $this->getAvailableSkills());
return $html;
}
示例11: build
public function build()
{
$availablePools = $this->testOBJ->getAvailableQuestionpools(true, $this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(), false, true, true);
require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$poolSelection = new ilSelectInputGUI(null, 'quest_pool_id');
$poolSelection->setOptions($this->buildSourcePoolSelectOptionsArray($availablePools));
$this->addInputItem($poolSelection, true);
$this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
$this->addFormButton($this->lng->txt('tst_rnd_quest_set_tb_add_pool_btn'), ilTestRandomQuestionSetConfigGUI::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM);
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:10,代码来源:class.ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI.php
示例12: transferAssignmentsFromOriginalToDuplicatedTaxonomy
private function transferAssignmentsFromOriginalToDuplicatedTaxonomy($originalTaxonomyId, $mappedTaxonomyId)
{
$originalTaxAssignment = new ilTaxNodeAssignment('qpl', $this->getSourcePoolId(), 'quest', $originalTaxonomyId);
$duplicatedTaxAssignment = new ilTaxNodeAssignment('tst', $this->testOBJ->getId(), 'quest', $mappedTaxonomyId);
foreach ($this->getQuestionIdMapping() as $originalQuestionId => $duplicatedQuestionId) {
$assignments = $originalTaxAssignment->getAssignmentsOfItem($originalQuestionId);
foreach ($assignments as $assData) {
$mappedNodeId = $this->duplicatedTaxonomiesKeysMap->getMappedTaxNodeId($assData['node_id']);
$duplicatedTaxAssignment->addAssignment($mappedNodeId, $duplicatedQuestionId);
}
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:12,代码来源:class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php
示例13: 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;
}
示例14: show
public function show()
{
require_once 'class.ilTestEvaluationGUI.php';
require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
global $ilUser;
$template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test");
$this->ilCtrl->setParameter($this, "skipfinalstatement", 1);
$template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1');
$template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next"));
$template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous"));
if ($this->test->getListOfQuestionsEnd()) {
$template->setVariable("CANCEL_CMD", 'outQuestionSummary');
} else {
$template->setVariable("CANCEL_CMD", 'backFromSummary');
}
$active = $this->test->getActiveIdOfUser($ilUser->getId());
$testevaluationgui = new ilTestEvaluationGUI($this->test);
$results = $this->test->getTestResult($active, $this->testSession->getPass());
$results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $this->testSession->getPass(), false, false, false, false);
if ($this->test->getShowExamviewPdf()) {
$template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
global $ilSetting;
$inst_id = $ilSetting->get('inst_id', null);
$path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf';
if (!is_dir($path)) {
ilUtil::makeDirParents($path);
}
$filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf';
require_once 'class.ilTestPDFGenerator.php';
ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
$template->setVariable("PDF_FILE_LOCATION", $filename);
} else {
$template->setCurrentBlock('prevent_double_form_subm');
$template->touchBlock('prevent_double_form_subm');
$template->parseCurrentBlock();
}
if ($this->test->getShowExamviewHtml()) {
if ($this->test->getListOfQuestionsEnd()) {
$template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary');
} else {
$template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary');
}
$template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next"));
$template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous"));
$template->setVariable('HTML_REVIEW', $results_output);
}
$this->tpl->setVariable($this->getContentBlockName(), $template->get());
}
示例15: 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;
}