コード例 #1
0
ファイル: class.ilTaxMDGUI.php プロジェクト: arlendotcn/ilias
 /**
  * Get selectable taxonomies for current object
  * 
  * @return array
  */
 protected function getSelectableTaxonomies()
 {
     global $objDefinition, $tree;
     if ($objDefinition->isRBACObject($this->md_obj_type)) {
         $res = array();
         // see ilTaxonomyBlockGUI::getActiveTaxonomies()
         // get all active taxonomies of parent objects
         foreach ($tree->getPathFull((int) $_REQUEST["ref_id"]) as $node) {
             // currently only active for categories
             if ($node["type"] == "cat") {
                 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
                 include_once "Services/Container/classes/class.ilContainer.php";
                 if (ilContainer::_lookupContainerSetting($node["obj_id"], ilObjectServiceSettingsGUI::TAXONOMIES, false)) {
                     include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
                     $tax_ids = ilObjTaxonomy::getUsageOfObject($node["obj_id"]);
                     if (sizeof($tax_ids)) {
                         $res = array_merge($res, $tax_ids);
                     }
                 }
             }
         }
         if (sizeof($res)) {
             return $res;
         }
     }
 }
コード例 #2
0
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "glo") {
         $deps = array();
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax_ids = array();
         foreach ($a_ids as $id) {
             $t_ids = ilObjTaxonomy::getUsageOfObject($id);
             if (count($t_ids) > 0) {
                 $tax_ids[$t_ids[0]] = $t_ids[0];
             }
         }
         if (sizeof($tax_ids)) {
             $deps[] = array("component" => "Services/Taxonomy", "entity" => "tax", "ids" => $tax_ids);
         }
         $advmd_ids = array();
         foreach ($a_ids as $id) {
             $rec_ids = $this->getActiveAdvMDRecords($id);
             if (sizeof($rec_ids)) {
                 foreach ($rec_ids as $rec_id) {
                     $advmd_ids[] = $id . ":" . $rec_id;
                 }
             }
         }
         if (sizeof($advmd_ids)) {
             $deps[] = array("component" => "Services/AdvancedMetaData", "entity" => "advmd", "ids" => $advmd_ids);
         }
         return $deps;
     }
     return array();
 }
 private function removeMirroredTaxonomies()
 {
     $taxonomyIds = ilObjTaxonomy::getUsageOfObject($this->testOBJ->getId());
     foreach ($taxonomyIds as $taxId) {
         $taxonomy = new ilObjTaxonomy($taxId);
         $taxonomy->delete();
     }
 }
 public function duplicate()
 {
     $poolTaxonomyIds = ilObjTaxonomy::getUsageOfObject($this->getSourcePoolId());
     foreach ($poolTaxonomyIds as $poolTaxId) {
         $this->duplicateTaxonomyFromPoolToTest($poolTaxId);
         $this->transferAssignmentsFromOriginalToDuplicatedTaxonomy($poolTaxId, $this->duplicatedTaxonomiesKeysMap->getMappedTaxonomyId($poolTaxId));
     }
 }
コード例 #5
0
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "glo") {
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax_ids = array();
         foreach ($a_ids as $id) {
             $t_ids = ilObjTaxonomy::getUsageOfObject($id);
             if (count($t_ids) > 0) {
                 $tax_ids[$t_ids[0]] = $t_ids[0];
             }
         }
         return array(array("component" => "Services/Taxonomy", "entity" => "tax", "ids" => $tax_ids));
     }
     return array();
 }
コード例 #6
0
 private function initFilteredQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, $taxonomyFilterSelection)
 {
     $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin, $dynamicQuestionSetConfig->getSourceQuestionPoolId());
     if ($dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) {
         require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
         $questionList->setAvailableTaxonomyIds(ilObjTaxonomy::getUsageOfObject($dynamicQuestionSetConfig->getSourceQuestionPoolId()));
         foreach ($taxonomyFilterSelection as $taxId => $taxNodes) {
             $questionList->addTaxonomyFilter($taxId, $taxNodes);
         }
     } elseif ($dynamicQuestionSetConfig->getOrderingTaxonomyId()) {
         $questionList->setAvailableTaxonomyIds(array($dynamicQuestionSetConfig->getOrderingTaxonomyId()));
     }
     $questionList->load();
     return $questionList;
 }
コード例 #7
0
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_assigned_object_id)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->assigned_object_id = $a_assigned_object_id;
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $this->setData(ilObjTaxonomy::getUsageOfObject($this->assigned_object_id, true));
     $this->setTitle($lng->txt("obj_taxf"));
     $this->addColumn($this->lng->txt("title"), "title");
     $this->addColumn($this->lng->txt("actions"));
     $this->setDefaultOrderField("title");
     $this->setDefaultOrderDirection("asc");
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.taxonomy_list_row.html", "Services/Taxonomy");
     //$this->addMultiCommand("", $lng->txt(""));
     //$this->addCommandButton("", $lng->txt(""));
 }
コード例 #8
0
 private function initFilteredQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
 {
     $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
     $questionList->setParentObjIdsFilter(array($dynamicQuestionSetConfig->getSourceQuestionPoolId()));
     $questionList->setAnswerStatusActiveId($filterSelection->getAnswerStatusActiveId());
     if ($dynamicQuestionSetConfig->isAnswerStatusFilterEnabled()) {
         $questionList->setAnswerStatusFilter($filterSelection->getAnswerStatusSelection());
     }
     if ($dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) {
         require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
         $questionList->setAvailableTaxonomyIds(ilObjTaxonomy::getUsageOfObject($dynamicQuestionSetConfig->getSourceQuestionPoolId()));
         foreach ($filterSelection->getTaxonomySelection() as $taxId => $taxNodes) {
             $questionList->addTaxonomyFilter($taxId, $taxNodes, $dynamicQuestionSetConfig->getSourceQuestionPoolId(), 'qpl');
         }
     } elseif ($dynamicQuestionSetConfig->getOrderingTaxonomyId()) {
         $questionList->setAvailableTaxonomyIds(array($dynamicQuestionSetConfig->getOrderingTaxonomyId()));
     }
     $questionList->setForcedQuestionIds($filterSelection->getForcedQuestionIds());
     $questionList->load();
     return $questionList;
 }
コード例 #9
0
 protected static function getActiveTaxonomiesForParentRefId($a_parent_ref_id)
 {
     global $tree;
     if (!isset(self::$valid_tax_map[$a_parent_ref_id])) {
         include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
         include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         include_once "Modules/Category/classes/class.ilObjCategoryGUI.php";
         $prefix = ilObjCategoryGUI::CONTAINER_SETTING_TAXBLOCK;
         $all_valid = array();
         foreach ($tree->getPathFull($a_parent_ref_id) as $node) {
             if ($node["type"] == "cat") {
                 $node_valid = array();
                 if (ilContainer::_lookupContainerSetting($node["obj_id"], ilObjectServiceSettingsGUI::TAXONOMIES, false)) {
                     $all_valid = array_merge($all_valid, ilObjTaxonomy::getUsageOfObject($node["obj_id"]));
                     $active = array();
                     foreach (ilContainer::_getContainerSettings($node["obj_id"]) as $keyword => $value) {
                         if (substr($keyword, 0, strlen($prefix)) == $prefix && (bool) $value) {
                             $active[] = substr($keyword, strlen($prefix));
                         }
                     }
                     $node_valid = array_intersect($all_valid, $active);
                 }
                 if (sizeof($node_valid)) {
                     foreach ($node_valid as $idx => $node_id) {
                         // #15268 - deleted taxonomy?
                         if (ilObject::_lookupType($node_id) != "tax") {
                             unset($node_valid[$idx]);
                         }
                     }
                 }
                 self::$valid_tax_map[$node["ref_id"]] = $node_valid;
             }
         }
     }
     return sizeof(self::$valid_tax_map[$a_parent_ref_id]);
 }
コード例 #10
0
 /**
  * Show taxonomy
  *
  * @param
  * @return
  */
 function showTaxonomy()
 {
     global $tpl, $lng;
     if (!$this->offlineMode() && $this->glossary->getShowTaxonomy()) {
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax_ids = ilObjTaxonomy::getUsageOfObject($this->glossary->getId());
         if (count($tax_ids) > 0) {
             include_once "./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php";
             $tpl->setLeftNavContent(ilObjTaxonomyGUI::getTreeHTML($tax_ids[0], "ilglossarypresentationgui", "listTerms", $lng->txt("cont_all_topics")));
         }
     }
 }
コード例 #11
0
 /**
  * List taxonomies
  *
  * @param
  * @return
  */
 function listTaxonomies()
 {
     global $tpl, $ilToolbar, $lng, $ilCtrl;
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
     if (count($tax_ids) == 0 || $this->getMultiple()) {
         $ilToolbar->addButton($lng->txt("tax_add_taxonomy"), $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy"));
     } else {
         ilUtil::sendInfo($lng->txt("tax_max_one_tax"));
     }
     include_once "./Services/Taxonomy/classes/class.ilTaxonomyListTableGUI.php";
     $tab = new ilTaxonomyListTableGUI($this, "listTaxonomies", $this->getAssignedObject(), $this->getListInfo());
     $tpl->setContent($tab->getHTML());
 }
コード例 #12
0
 /**
  * get ids of all taxonomies corresponding to current pool
  *
  * @return array
  */
 public function getTaxonomyIds()
 {
     require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
     return ilObjTaxonomy::getUsageOfObject($this->getId());
 }
コード例 #13
0
 /**
  * Show taxonomy
  *
  * @param
  * @return
  */
 function showTaxonomy()
 {
     global $tpl, $lng;
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
     if (count($tax_ids) > 0) {
         include_once "./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php";
         $tax_exp = new ilTaxonomyExplorerGUI($this, "showTaxonomy", $tax_ids[0], "ilobjglossarygui", "listTerms");
         if (!$tax_exp->handleCommand()) {
             //$tpl->setLeftNavContent($tax_exp->getHTML());
             $tpl->setLeftNavContent($tax_exp->getHTML() . " ");
         }
     }
 }
コード例 #14
0
 protected function getTaxonomiesForRefId()
 {
     global $tree;
     include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
     include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     // see ilTaxMDGUI::getSelectableTaxonomies()
     $res = array();
     foreach ($tree->getPathFull($this->object->getRefId()) as $node) {
         // find all defined taxes for parent node, activation is not relevant
         $node_taxes = ilObjTaxonomy::getUsageOfObject($node["obj_id"], true);
         if (sizeof($node_taxes)) {
             foreach ($node_taxes as $node_tax) {
                 $res[$node_tax["tax_id"]] = array("title" => $node_tax["title"], "source" => $node["child"]);
             }
         }
     }
     asort($res);
     return $res;
 }
コード例 #15
0
 private function buildFilteredQuestionsTableGUI()
 {
     require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
     $taxIds = ilObjTaxonomy::getUsageOfObject($this->dynamicQuestionSetConfig->getSourceQuestionPoolId());
     include_once "./Modules/Test/classes/tables/class.ilFilteredQuestionsTableGUI.php";
     $gui = new ilFilteredQuestionsTableGUI($this, 'showQuestionSelection', $this->object->getShowMarker(), $taxIds);
     $gui->setFilterCommand('filterQuestionSelection');
     $gui->setResetCommand('resetQuestionSelection');
     return $gui;
 }
コード例 #16
0
 /**
  * Init settings form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initSettingsForm($a_mode = "edit")
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // online
     $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
     $cb->setValue("y");
     $this->form->addItem($cb);
     // glossary mode
     $options = array("none" => $this->lng->txt("glo_mode_normal"), "level" => $this->lng->txt("glo_mode_level"), "subtree" => $this->lng->txt("glo_mode_subtree"));
     $si = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode");
     $si->setOptions($options);
     $si->setInfo($lng->txt("glo_mode_desc"));
     $this->form->addItem($si);
     // presentation mode
     $radg = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode");
     $radg->setValue("table");
     $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info"));
     // short text length
     $ni = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length");
     $ni->setMaxValue(3000);
     $ni->setMinValue(100);
     $ni->setMaxLength(4);
     $ni->setSize(4);
     $ni->setInfo($lng->txt("glo_text_snippet_length_info"));
     $ni->setValue(200);
     $op1->addSubItem($ni);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info"));
     $radg->addOption($op2);
     $this->form->addItem($radg);
     // show taxonomy
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
     if (count($tax_ids) > 0) {
         $cb = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
         $this->form->addItem($cb);
     }
     // downloads
     $cb = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads");
     $cb->setValue("y");
     $cb->setInfo($lng->txt("cont_downloads_desc"));
     $this->form->addItem($cb);
     // save and cancel commands
     $this->form->addCommandButton("saveProperties", $lng->txt("save"));
     $this->form->setTitle($lng->txt("cont_glo_properties"));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
 }
コード例 #17
0
 public function cloneDependencies($a_target_id, $a_copy_id)
 {
     parent::cloneDependencies($a_target_id, $a_copy_id);
     // clone taxonomies
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $all_tax = ilObjTaxonomy::getUsageOfObject($this->getId());
     if (sizeof($all_tax)) {
         include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
         $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
         $mappings = $cwo->getMappings();
         foreach ($all_tax as $old_tax_id) {
             if ($old_tax_id) {
                 // clone it
                 $old_tax = new ilObjTaxonomy($old_tax_id);
                 $new_tax = $old_tax->cloneObject(0, 0, true);
                 $tax_map = $old_tax->getNodeMapping();
                 // assign new taxonomy to new category
                 ilObjTaxonomy::saveUsage($new_tax->getId(), ilObject::_lookupObjId($a_target_id));
                 // clone assignments (for all sub-items)
                 foreach ($mappings as $old_ref_id => $new_ref_id) {
                     if ($old_ref_id != $new_ref_id) {
                         $old_obj_id = ilObject::_lookupObjId($old_ref_id);
                         $new_obj_id = ilObject::_lookupObjId($new_ref_id);
                         $obj_type = ilObject::_lookupType($old_obj_id);
                         $tax_ass = new ilTaxNodeAssignment($obj_type, $old_obj_id, "obj", $old_tax_id);
                         $assignmts = $tax_ass->getAssignmentsOfItem($old_obj_id);
                         if (sizeof($assignmts)) {
                             $new_tax_ass = new ilTaxNodeAssignment($obj_type, $new_obj_id, "obj", $new_tax->getId());
                             foreach ($assignmts as $a) {
                                 if ($tax_map[$a["node_id"]]) {
                                     $new_tax_ass->addAssignment($tax_map[$a["node_id"]], $new_obj_id);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #18
0
 private function saveEditSourcePoolDefinitionFormCmd()
 {
     $this->questionSetConfig->loadFromDb();
     $defId = $this->fetchSingleSourcePoolDefinitionIdParameter();
     $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId);
     $availableTaxonomyIds = ilObjTaxonomy::getUsageOfObject($sourcePoolDefinition->getPoolId());
     $form = $this->buildEditSourcePoolDefinitionFormGUI();
     $form->build($sourcePoolDefinition, $availableTaxonomyIds);
     $errors = !$form->checkInput();
     // ALWAYS CALL BEFORE setValuesByPost()
     $form->setValuesByPost();
     // NEVER CALL THIS BEFORE checkInput()
     if ($errors) {
         return $this->showSourcePoolDefinitionListCmd($form);
     }
     $form->applySubmit($sourcePoolDefinition, $availableTaxonomyIds);
     $sourcePoolDefinition->saveToDb();
     $this->sourcePoolDefinitionList->loadDefinitions();
     $this->stagingPool->rebuild($this->sourcePoolDefinitionList);
     $this->questionSetConfig->setLastQuestionSyncTimestamp(time());
     $this->questionSetConfig->saveToDb();
     $this->sourcePoolDefinitionList->saveDefinitions();
     $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
     ilUtil::sendSuccess($this->lng->txt("tst_msg_random_question_set_config_modified"), true);
     $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
 }
コード例 #19
0
 /**
  * Determine current taxonomy (of assigned object)
  *
  * @param
  * @return
  */
 function determineAOCurrentTaxonomy()
 {
     // get taxonomy
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
     $tax = new ilObjTaxonomy(current($tax_ids));
     return $tax;
 }
コード例 #20
0
 private function buildTaxonomySelectInputOptionArray($questionPoolId)
 {
     $taxSelectOptions = array(0 => $this->lng->txt('please_select'));
     if ($questionPoolId) {
         require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
         $taxIds = ilObjTaxonomy::getUsageOfObject($questionPoolId);
         foreach ($taxIds as $taxId) {
             $taxSelectOptions[$taxId] = ilObject::_lookupTitle($taxId);
         }
     }
     return $taxSelectOptions;
 }
コード例 #21
0
 /**
  * Show taxonomy
  *
  * @param
  * @return
  */
 function showTaxonomy()
 {
     global $tpl, $lng;
     if (!$this->offlineMode() && $this->glossary->getShowTaxonomy()) {
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax_ids = ilObjTaxonomy::getUsageOfObject($this->glossary->getId());
         if (count($tax_ids) > 0) {
             include_once "./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php";
             $tax_exp = new ilTaxonomyExplorerGUI($this, "showTaxonomy", $tax_ids[0], "ilglossarypresentationgui", "listTerms");
             if (!$tax_exp->handleCommand()) {
                 //$tpl->setLeftNavContent($tax_exp->getHTML());
                 $tpl->setLeftContent($tax_exp->getHTML() . " ");
             }
             return;
             include_once "./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php";
             $tpl->setLeftNavContent(ilObjTaxonomyGUI::getTreeHTML($tax_ids[0], "ilglossarypresentationgui", "listTerms", $lng->txt("cont_all_topics")));
         }
     }
 }
コード例 #22
0
 /**
  * Get taxonomy
  *
  * @return int taxononmy ID
  */
 function getTaxonomyId()
 {
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getId());
     if (count($tax_ids) > 0) {
         // glossaries handle max. one taxonomy
         return $tax_ids[0];
     }
     return 0;
 }
コード例 #23
0
 /**
  * list questions of question pool
  */
 function questionsObject()
 {
     global $rbacsystem, $ilUser, $ilCtrl, $ilDB, $lng, $ilPluginAdmin;
     if (get_class($this->object) == "ilObjTest") {
         if ($_GET["calling_test"] > 0) {
             $ref_id = $_GET["calling_test"];
             $q_id = $_GET["q_id"];
             if ($_REQUEST['test_express_mode']) {
                 if ($q_id) {
                     ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
                 } else {
                     ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
                 }
             } else {
                 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions");
             }
         }
     } else {
         if (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
             $ref_id = (int) $_GET['calling_consumer'];
             $consumer = ilObjectFactory::getInstanceByRefId($ref_id);
             if ($consumer instanceof ilQuestionEditingFormConsumer) {
                 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context']));
             }
             require_once 'Services/Link/classes/class.ilLink.php';
             ilUtil::redirect(ilLink::_getLink($ref_id));
         }
     }
     $this->object->purgeQuestions();
     // reset test_id SESSION variable
     $_SESSION["test_id"] = "";
     require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
     $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
     $table_gui = $this->buildQuestionBrowserTableGUI($taxIds);
     $table_gui->setPreventDoubleSubmission(false);
     if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
         $toolbar = new ilToolbarGUI();
         $toolbar->addButton($this->lng->txt("ass_create_question"), $this->ctrl->getLinkTarget($this, 'createQuestionForm'));
         $this->tpl->setContent($this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui));
     } else {
         $this->tpl->setContent($this->ctrl->getHTML($table_gui));
     }
     if ($this->object->getShowTaxonomies()) {
         $this->lng->loadLanguageModule('tax');
         require_once 'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
         foreach ($taxIds as $taxId) {
             if ($taxId != $this->object->getNavTaxonomyId()) {
                 continue;
             }
             $taxExp = new ilTaxonomyExplorerGUI($this, 'showNavTaxonomy', $taxId, 'ilobjquestionpoolgui', 'questions');
             if (!$taxExp->handleCommand()) {
                 $this->tpl->setLeftContent($taxExp->getHTML() . " ");
             }
             break;
         }
     }
 }
コード例 #24
0
 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;
 }
コード例 #25
0
 /**
  * Get all terms for given set of glossary ids.
  * 
  * @param 	integer/array	array of glossary ids for meta glossaries
  * @param	string			searchstring
  * @param	string			first letter
  * @return	array			array of terms 
  */
 static function getFirstLetters($a_glo_id, $a_tax_node = 0)
 {
     global $ilDB;
     $terms = array();
     // meta glossary
     if (is_array($a_glo_id)) {
         $where = $ilDB->in("glo_id", $a_glo_id, false, "integer");
     } else {
         $where = " glo_id = " . $ilDB->quote($a_glo_id, "integer") . " ";
         // get all term ids under taxonomy node (if given)
         if ($a_tax_node > 1) {
             include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
             $tax_ids = ilObjTaxonomy::getUsageOfObject($a_glo_id);
             if (count($tax_ids) > 0) {
                 $items = ilObjTaxonomy::getSubTreeItems("glo", $a_glo_id, "term", $tax_ids[0], $a_tax_node);
                 $sub_tree_ids = array();
                 foreach ($items as $i) {
                     $sub_tree_ids[] = $i["item_id"];
                 }
                 $in = " AND " . $ilDB->in("id", $sub_tree_ids, false, "integer");
             }
         }
         $where .= $in;
     }
     $q = "SELECT DISTINCT " . $ilDB->upper($ilDB->substr("term", 1, 1)) . " let FROM glossary_term WHERE " . $where . " ORDER BY let";
     $let_set = $ilDB->query($q);
     $lets = array();
     while ($let_rec = $ilDB->fetchAssoc($let_set)) {
         $let[$let_rec["let"]] = $let_rec["let"];
     }
     return $let;
 }
コード例 #26
0
 private function buildQuestionSetFilteredStatisticTableGUI()
 {
     require_once 'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
     $gui = $this->buildQuestionSetStatisticTableGUI(ilTestDynamicQuestionSetStatisticTableGUI::FILTERED_TABLE_ID);
     $gui->initTitle('tst_dynamic_question_set_selection');
     $gui->initColumns('tst_num_selected_questions');
     require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
     $gui->setTaxIds(ilObjTaxonomy::getUsageOfObject($this->dynamicQuestionSetConfig->getSourceQuestionPoolId()));
     $gui->initFilter();
     $gui->setFilterCommand('filterQuestionSelection');
     $gui->setResetCommand('resetQuestionSelection');
     return $gui;
 }