public function initFilter() { $this->setDisableFilterHiding(true); include_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $available_questions = new ilSelectInputGUI($this->lng->txt('question'), 'question'); $select_questions = array(); if (!$this->getParentObject()->object->isRandomTest()) { $questions = $this->getParentObject()->object->getTestQuestions(); } else { $questions = $this->getParentObject()->object->getPotentialRandomTestQuestions(); } $scoring = ilObjAssessmentFolder::_getManualScoring(); foreach ($questions as $data) { include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php'; $info = assQuestion::_getQuestionInfo($data['question_id']); $type = $info["question_type_fi"]; if (in_array($type, $scoring)) { $maxpoints = assQuestion::_getMaximumPoints($data["question_id"]); if ($maxpoints == 1) { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')'; } else { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')'; } $select_questions[$data["question_id"]] = $data['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $data["question_id"] . ']'; } } if (!$select_questions) { $select_questions[0] = $this->lng->txt('tst_no_scorable_qst_available'); } $available_questions->setOptions(array('' => $this->lng->txt('please_choose')) + $select_questions); $this->addFilterItem($available_questions); $available_questions->readFromSession(); $this->filter['question'] = $available_questions->getValue(); $pass = new ilSelectInputGUI($this->lng->txt('pass'), 'pass'); $passes = array(); $max_pass = $this->getParentObject()->object->getMaxPassOfTest(); for ($i = 1; $i <= $max_pass; $i++) { $passes[$i] = $i; } $pass->setOptions($passes); $this->addFilterItem($pass); $pass->readFromSession(); $this->filter['pass'] = $pass->getValue(); }
/** * Get's the repository object ID of a parent object, if possible * * see ilWebAccessChecker */ function getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids = false) { if (is_int(strpos($a_usage["type"], ":"))) { $us_arr = explode(":", $a_usage["type"]); $type = $us_arr[1]; $cont_type = $us_arr[0]; } else { $type = $a_usage["type"]; } $id = $a_usage["id"]; $obj_id = false; switch ($type) { // RTE / tiny mce case "html": switch ($cont_type) { case "qpl": // Question Pool *Question* Text (Test) include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $qinfo = assQuestion::_getQuestionInfo($id); if ($qinfo["original_id"] > 0) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test } else { $obj_id = $qinfo["obj_fi"]; // usage in pool } break; case "spl": // Question Pool *Question* Text (Survey) include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; $quest = SurveyQuestion::_instanciateQuestion($id); if ($quest) { if ($quest->getOriginalId() > 0) { $obj_id = $quest->getSurveyId(); } else { $obj_id = $quest->getObjId(); // usage in pool } unset($quest); } break; case "exca": // Exercise assignment $returned_pk = $a_usage['id']; // we are just checking against exercise object include_once 'Modules/Exercise/classes/class.ilObjExercise.php'; $obj_id = ilObjExercise::lookupExerciseIdForReturnedId($returned_pk); break; case "frm": // Forum $post_pk = $a_usage['id']; include_once 'Modules/Forum/classes/class.ilForumPost.php'; include_once 'Modules/Forum/classes/class.ilForum.php'; $oPost = new ilForumPost($post_pk); $frm_pk = $oPost->getForumId(); $obj_id = ilForum::_lookupObjIdForForumId($frm_pk); break; // temporary items (per user) // temporary items (per user) case "frm~": case "exca~": $obj_id = $a_usage['id']; break; // "old" category pages // "old" category pages case "cat": // InfoScreen Text // InfoScreen Text case "tst": case "svy": // data collection // data collection case "dcl": $obj_id = $id; break; } break; // page editor // page editor case "pg": switch ($cont_type) { case "qpl": // Question Pool Question Pages include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $qinfo = assQuestion::_getQuestionInfo($id); if ($qinfo["original_id"] > 0) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test } else { $obj_id = $qinfo["obj_fi"]; // usage in pool } break; case "lm": case "dbk": // learning modules include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; $obj_id = ilLMObject::_lookupContObjID($id); break; case "gdf": // glossary definition include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $term_id = ilGlossaryDefinition::_lookupTermId($id); $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id); break; case "wpg": // wiki page include_once 'Modules/Wiki/classes/class.ilWikiPage.php'; $obj_id = ilWikiPage::lookupObjIdByPage($id); break; case "sahs": // sahs page // can this implementation be used for other content types, too? include_once './Services/COPage/classes/class.ilPageObject.php'; $obj_id = ilPageObject::lookupParentId($id, 'sahs'); break; case "prtf": // portfolio include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php"; $obj_id = ilPortfolioPage::findPortfolioForPage($id); break; case "prtt": // portfolio template include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php"; $obj_id = ilPortfolioTemplatePage::findPortfolioForPage($id); break; case "blp": // blog include_once './Services/COPage/classes/class.ilPageObject.php'; $obj_id = ilPageObject::lookupParentId($id, 'blp'); break; case "crs": case "grp": case "cat": case "fold": case "root": // repository pages $obj_id = $id; break; } break; // Media Pool // Media Pool case "mep": $obj_id = $id; break; // News Context Object (e.g. MediaCast) // News Context Object (e.g. MediaCast) case "news": include_once "./Services/News/classes/class.ilNewsItem.php"; $obj_id = ilNewsItem::_lookupContextObjId($id); break; } return $obj_id; }
/** * Get's the repository object ID of a parent object, if possible */ function getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids = false) { if (is_int(strpos($a_usage["type"], ":"))) { $us_arr = explode(":", $a_usage["type"]); $type = $us_arr[1]; $cont_type = $us_arr[0]; } else { $type = $a_usage["type"]; } $id = $a_usage["id"]; $obj_id = false; switch ($type) { case "html": // "old" category pages if ($cont_type == "cat") { $obj_id = $id; } // Test InfoScreen Text if ($cont_type == "tst" || $cont_type == "svy") { $obj_id = $id; //var_dump($qinfo); } // Question Pool *Question* Text (Test) if ($cont_type == "qpl") { include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $qinfo = assQuestion::_getQuestionInfo($id); if ($qinfo["original_id"] > 0) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test } else { $obj_id = $qinfo["obj_fi"]; // usage in pool } } // Question Pool *Question* Text (Survey) if ($cont_type == "spl") { include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; $quest = SurveyQuestion::_instanciateQuestion($id); if ($quest) { if ($quest->getOriginalId() > 0) { $obj_id = $quest->getSurveyId(); } else { $obj_id = $quest->getObjId(); // usage in pool } unset($quest); } } // Forum if ($cont_type == "frm") { $post_pk = $a_usage['id']; include_once 'Modules/Forum/classes/class.ilForumPost.php'; include_once 'Modules/Forum/classes/class.ilForum.php'; $oPost = new ilForumPost($post_pk); $frm_pk = $oPost->getForumId(); $obj_id = ilForum::_lookupObjIdForForumId($frm_pk); } if ($cont_type == 'frm~') { $obj_id = $a_usage['id']; } if ($cont_type == "dcl") { $obj_id = $id; } break; case "pg": // Question Pool Question Pages if ($cont_type == "qpl") { include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $qinfo = assQuestion::_getQuestionInfo($id); if ($qinfo["original_id"] > 0) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test } else { $obj_id = $qinfo["obj_fi"]; // usage in pool } } // learning modules if ($cont_type == "lm" || $cont_type == "dbk") { include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; $obj_id = ilLMObject::_lookupContObjID($id); } // glossary definition if ($cont_type == "gdf") { include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $term_id = ilGlossaryDefinition::_lookupTermId($id); $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id); } // wiki page if ($cont_type == 'wpg') { include_once 'Modules/Wiki/classes/class.ilWikiPage.php'; $obj_id = ilWikiPage::lookupObjIdByPage($id); } // sahs page if ($cont_type == 'sahs') { // can this implementation be used for other content types, too? include_once './Services/COPage/classes/class.ilPageObject.php'; $obj_id = ilPageObject::lookupParentId($id, 'sahs'); } // repository pages if (in_array($cont_type, array("crs", "grp", "cat", "fold", "root"))) { $obj_id = $id; } if ($cont_type == 'prtf') { include_once "Services/Portfolio/classes/class.ilPortfolioPage.php"; $obj_id = ilPortfolioPage::findPortfolioForPage($id); } if ($cont_type == 'blp') { include_once './Services/COPage/classes/class.ilPageObject.php'; $obj_id = ilPageObject::lookupParentId($id, 'blp'); } break; // Media Pool // Media Pool case "mep": $obj_id = $id; break; // News Context Object (e.g. MediaCast) // News Context Object (e.g. MediaCast) case "news": include_once "./Services/News/classes/class.ilNewsItem.php"; $obj_id = ilNewsItem::_lookupContextObjId($id); break; } return $obj_id; }
/** * */ private function showManScoringByQuestionParticipantsTable($manPointsPost = array()) { /** * @var $tpl ilTemplate * @var $ilAccess ilAccessHandler */ global $tpl, $ilAccess; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true); $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen'); } include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $mathJaxSetting = new ilSetting('MathJax'); if ($mathJaxSetting->get("enable")) { $tpl->addJavaScript($mathJaxSetting->get("path_to_mathjax")); } $tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $tpl->addJavaScript("./Services/Form/js/Form.js"); $tpl->addCss($this->object->getTestStyleLocation("output"), "screen"); require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php'; $table = new ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI($this); $table->setManualScoringPointsPostData($manPointsPost); $qst_id = $table->getFilterItemByPostVar('question')->getValue(); $pass_id = $table->getFilterItemByPostVar('pass')->getValue(); $table_data = array(); $selected_questionData = null; if (is_numeric($qst_id)) { $scoring = ilObjAssessmentFolder::_getManualScoring(); $info = assQuestion::_getQuestionInfo($qst_id); $selected_questionData = $info; $type = $info["question_type_fi"]; if (in_array($type, $scoring)) { $selected_questionData = $info; } } if ($selected_questionData && is_numeric($pass_id)) { $data = $this->object->getCompleteEvaluationData(FALSE); foreach ($data->getParticipants() as $active_id => $participant) { $testResultData = $this->object->getTestResult($active_id, $pass_id - 1); foreach ($testResultData as $questionData) { if (!isset($questionData['qid']) || $questionData['qid'] != $selected_questionData['question_id']) { continue; } $table_data[] = array('pass_id' => $pass_id - 1, 'active_id' => $active_id, 'qst_id' => $questionData['qid'], 'reached_points' => assQuestion::_getReachedPoints($active_id, $questionData['qid'], $pass_id - 1), 'maximum_points' => assQuestion::_getMaximumPoints($questionData['qid']), 'participant' => $participant); } } } else { $table->disable('header'); } if ($selected_questionData) { $maxpoints = assQuestion::_getMaximumPoints($selected_questionData['question_id']); if ($maxpoints == 1) { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')'; } else { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')'; } $table->setTitle($this->lng->txt('tst_man_scoring_by_qst') . ': ' . $selected_questionData['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $selected_questionData['question_id'] . ']'); } else { $table->setTitle($this->lng->txt('tst_man_scoring_by_qst')); } $table->setData($table_data); $tpl->setContent($table->getHTML()); }