本文整理汇总了PHP中ilObjTest::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::getId方法的具体用法?PHP ilObjTest::getId怎么用?PHP ilObjTest::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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
示例4: 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();
}
示例5: 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;
}
示例6: 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;
}
示例7: createFromTest
/**
* Import relevant properties from given test
*
* @param ilObjTest $a_test
* @return object
*/
public static function createFromTest(ilObjTest $a_test, $a_user_id)
{
global $lng;
$lng->loadLanguageModule("wsp");
$newObj = new self();
$newObj->setTitle($lng->txt("wsp_type_tstv") . " \"" . $a_test->getTitle() . "\"");
$newObj->setDescription($a_test->getDescription());
$active_id = $a_test->getActiveIdOfUser($a_user_id);
$pass = ilObjTest::_getResultPass($active_id);
$date = $a_test->getPassFinishDate($active_id, $pass);
$newObj->setProperty("issued_on", new ilDate($date, IL_CAL_UNIX));
// create certificate
include_once "Services/Certificate/classes/class.ilCertificate.php";
include_once "Modules/Test/classes/class.ilTestCertificateAdapter.php";
$certificate = new ilCertificate(new ilTestCertificateAdapter($a_test));
$certificate = $certificate->outCertificate(array("active_id" => $active_id, "pass" => $pass), false);
// save pdf file
if ($certificate) {
// we need the object id for storing the certificate file
$newObj->create();
$path = self::initStorage($newObj->getId(), "certificate");
$file_name = "tst_" . $a_test->getId() . "_" . $a_user_id . "_" . $active_id . ".pdf";
if (file_put_contents($path . $file_name, $certificate)) {
$newObj->setProperty("file", $file_name);
$newObj->update();
return $newObj;
}
// file creation failed, so remove to object, too
$newObj->delete();
}
}
示例8: getFilteredTestResult
protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
{
global $ilDB, $ilPluginAdmin;
$table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
$table_gui->initFilter();
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
$questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
$questionList->setParentObjIdsFilter(array($this->object->getId()));
$questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
foreach ($table_gui->getFilterItems() as $item) {
if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
$v = $item->getValue();
if (is_array($v) && count($v) && !(int) $v[0]) {
continue;
}
$taxId = substr($item->getPostVar(), strlen('tax_'));
$questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
} elseif ($item->getValue() !== false) {
$questionList->addFieldFilter($item->getPostVar(), $item->getValue());
}
}
$questionList->load();
$filteredTestResult = array();
$resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
foreach ($resultData as $resultItemKey => $resultItemValue) {
if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
continue;
}
if (!$questionList->isInList($resultItemValue['qid'])) {
continue;
}
$filteredTestResult[] = $resultItemValue;
}
return $filteredTestResult;
}
示例9: getAvailableTaxonomyIds
private function getAvailableTaxonomyIds()
{
if ($this->getAvailableTaxonomyIds === null) {
require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
$this->availableTaxonomyIds = (array) ilObjTaxonomy::getUsageOfObject($this->testOBJ->getId());
}
return $this->availableTaxonomyIds;
}
示例10: getQuestionContainerId
private function getQuestionContainerId()
{
if ($this->testOBJ->isDynamicTest()) {
$questionSetConfigFactory = new ilTestQuestionSetConfigFactory($this->tree, $this->db, $this->pluginAdmin, $this->testOBJ);
$questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
return $questionSetConfig->getSourceQuestionPoolId();
}
return $this->testOBJ->getId();
}
示例11: mirrorSourcePoolTaxonomies
private function mirrorSourcePoolTaxonomies($sourcePoolId, $questionIdMapping)
{
$duplicator = new ilQuestionPoolTaxonomiesDuplicator();
$duplicator->setSourceObjId($sourcePoolId);
$duplicator->setSourceObjType('qpl');
$duplicator->setTargetObjId($this->testOBJ->getId());
$duplicator->setTargetObjType($this->testOBJ->getType());
$duplicator->setQuestionIdMapping($questionIdMapping);
$duplicator->duplicate();
return $duplicator->getDuplicatedTaxonomiesKeysMap();
}
示例12: cloneQuestionSetRelatedData
/**
* removes all question set config related data for cloned/copied test
*
* @param ilObjTest $cloneTestOBJ
*/
public function cloneQuestionSetRelatedData($cloneTestOBJ)
{
global $ilLog;
require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$cwo = ilCopyWizardOptions::_getInstance($cloneTestOBJ->getId());
foreach ($this->questions as $key => $question_id) {
$question = assQuestion::_instanciateQuestion($question_id);
$cloneTestOBJ->questions[$key] = $question->duplicate(true, null, null, null, $cloneTestOBJ->getId());
$original_id = assQuestion::_getOriginalId($question_id);
$question = assQuestion::_instanciateQuestion($cloneTestOBJ->questions[$key]);
$question->saveToDb($original_id);
// Save the mapping of old question id <-> new question id
// This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
$originalKey = $this->testOBJ->getRefId() . '_' . $question_id;
$mappedKey = $cloneTestOBJ->getRefId() . '_' . $cloneTestOBJ->questions[$key];
$cwo->appendMapping($originalKey, $mappedKey);
$ilLog->write(__METHOD__ . ": Added mapping {$originalKey} <-> {$mappedKey}");
}
}
示例13: recalculatePasses
/**
* @param $userdata
* @param $active_id
*/
public function recalculatePasses($userdata, $active_id)
{
require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php';
// Below!
require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
require_once './Modules/Test/classes/class.ilTestArchiver.php';
$passes = $userdata->getPasses();
foreach ($passes as $pass => $passdata) {
if (is_object($passdata)) {
$this->recalculatePass($passdata, $active_id, $pass);
if ($this->test->getEnableArchiving()) {
// requires out of the loop!
$test_evaluation_gui = new ilTestEvaluationGUI($this->test);
$overview = $test_evaluation_gui->getPassListOfAnswers($passdata, $active_id, $pass, true, false, false, true);
$filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf';
ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
$archiver = new ilTestArchiver($this->test->getId());
$archiver->handInTestResult($active_id, $pass, $filename);
unlink($filename);
}
}
}
}
示例14: copyQuestionObject
public function copyQuestionObject()
{
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 ($_REQUEST['q_id'] && !is_array($_REQUEST['q_id'])) {
$ids = array($_REQUEST['q_id']);
} else {
if ($_REQUEST['q_id']) {
$ids = $_REQUEST['q_id'];
} else {
ilUtil::sendFailure($this->lng->txt('copy_no_questions_selected'), true);
$this->ctrl->redirect($this, 'questions');
}
}
$copy_count = 0;
$questionTitles = $this->object->getQuestionTitles();
foreach ($ids as $id) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = assQuestion::_instanciateQuestionGUI($id);
if ($question) {
$title = $question->object->getTitle();
$i = 2;
while (in_array($title . ' (' . $i . ')', $questionTitles)) {
$i++;
}
$title .= ' (' . $i . ')';
$questionTitles[] = $title;
$new_id = $question->object->duplicate(false, $title);
$clone = assQuestion::_instanciateQuestionGUI($new_id);
$clone->object->setObjId($this->object->getId());
$clone->object->saveToDb();
$this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $new_id, true);
$copy_count++;
}
}
ilUtil::sendSuccess($this->lng->txt('copy_questions_success'), true);
$this->ctrl->redirect($this, 'questions');
}
示例15: exportXHTMLMediaObjects
function exportXHTMLMediaObjects($a_export_dir)
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->test_obj->getId());
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->exportFiles($a_export_dir);
unset($mob_obj);
}
}
foreach ($this->test_obj->questions as $question_id) {
$mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->exportFiles($a_export_dir);
unset($mob_obj);
}
}
}
}