/** * @param ilObjTaxonomy $originalTaxonomyId * @param ilObjTaxonomy $mappedTaxonomyId */ public function addDuplicatedTaxonomy(ilObjTaxonomy $originalTaxonomy, ilObjTaxonomy $mappedTaxonomy) { $this->taxonomyKeyMap[$originalTaxonomy->getId()] = $mappedTaxonomy->getId(); foreach ($originalTaxonomy->getNodeMapping() as $originalNodeId => $mappedNodeId) { $this->taxNodeKeyMap[$originalNodeId] = $mappedNodeId; } }
private function removeMirroredTaxonomies() { $taxonomyIds = ilObjTaxonomy::getUsageOfObject($this->testOBJ->getId()); foreach ($taxonomyIds as $taxId) { $taxonomy = new ilObjTaxonomy($taxId); $taxonomy->delete(); } }
private function duplicateTaxonomyFromPoolToTest($poolTaxonomyId) { $testTaxonomy = new ilObjTaxonomy(); $testTaxonomy->create(); $poolTaxonomy = new ilObjTaxonomy($poolTaxonomyId); $poolTaxonomy->doCloneObject($testTaxonomy, null, null); $poolTaxonomy->getTree()->readRootId(); $testTaxonomy->getTree()->readRootId(); $testTaxonomy->update(); ilObjTaxonomy::saveUsage($testTaxonomy->getId(), $this->testOBJ->getId()); $this->duplicatedTaxonomiesKeysMap->addDuplicatedTaxonomy($poolTaxonomy, $testTaxonomy); }
/** * 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; } } }
/** * 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(); }
/** * 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(); }
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; }
/** * 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("")); }
/** * Final processing * * @param * @return */ function finalProcessing($a_mapping) { //echo "<pre>".print_r($a_mapping, true)."</pre>"; exit; // get all glossaries of the import include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; $maps = $a_mapping->getMappingsOfEntity("Modules/Glossary", "glo"); foreach ($maps as $old => $new) { if ($old != "new_id" && (int) $old > 0) { // get all new taxonomys of this object $new_tax_ids = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $old); $tax_ids = explode(":", $new_tax_ids); foreach ($tax_ids as $tid) { ilObjTaxonomy::saveUsage($tid, $new); } } } }
/** * Constructor * * @param * @return */ function __construct($a_parent_obj, $a_parent_cmd, $a_tax_id, $a_target_gui, $a_target_cmd, $a_id = "") { include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php"; $this->tax_tree = new ilTaxonomyTree($a_tax_id); if ($a_id != "") { $this->id = $a_id; } else { $this->id = "tax_expl_" . $this->tax_tree->getTreeId(); } include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; if (ilObjTaxonomy::lookupSortingMode($a_tax_id) == ilObjTaxonomy::SORT_ALPHABETICAL) { $this->setOrderField("title"); } else { $this->setOrderField("order_nr", true); } $this->setPreloadChilds(true); $this->target_gui = $a_target_gui; $this->target_cmd = $a_target_cmd; //$this->setOrderField("title"); parent::__construct($this->id, $a_parent_obj, $a_parent_cmd, $this->tax_tree); }
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; }
/** * Constructor * @access public * @param string scriptname * @param int user_id */ function __construct($a_target, $a_tax_tree, $a_gui_class = "ilobjtaxonomygui", $a_gui_cmd = "listItems") { global $lng; parent::__construct($a_target); include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; $sort_mode = ilObjTaxonomy::lookupSortingMode($a_tax_tree->getTreeId()); $this->setPostSort(false); if ($sort_mode == ilObjTaxonomy::SORT_MANUAL) { $this->setPostSort(true); } //$this->setFilterMode(IL_FM_POSITIVE); //$this->addFilter("tax"); $this->gui_class = $a_gui_class; $this->gui_cmd = $a_gui_cmd; $this->tree = $a_tax_tree; $this->root_id = $this->tree->readRootId(); $this->setSessionExpandVariable("txexpand"); $this->checkPermissions(false); // $this->setOrderColumn("order_nr"); // $this->textwidth = 200; $this->force_open_path = array(); $this->setRootNodeTitle($lng->txt("tax_taxonomy")); }
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]); }
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); }
/** * 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"))); } } }
/** * Set sub tabs */ function setSettingsSubTabs($a_active) { global $ilTabs, $ilCtrl, $lng; if (in_array($a_active, array("general_settings", "style", "taxonomy"))) { // general properties $ilTabs->addSubTab("general_settings", $lng->txt("cont_glo_properties"), $ilCtrl->getLinkTarget($this, 'properties')); // style properties $ilTabs->addSubTab("style", $lng->txt("obj_sty"), $ilCtrl->getLinkTarget($this, 'editStyleProperties')); // taxonomy include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; ilObjTaxonomy::loadLanguageModule(); $ilTabs->addSubTab("taxonomy", $lng->txt("tax_taxonomy"), $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", 'editAOTaxonomySettings')); $ilTabs->activateSubTab($a_active); } }
public function build(ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $availableTaxonomyIds) { $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI)); $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form')); $this->setId('tstRndQuestSetCfgPoolForm'); $this->addCommandButton($this->getSaveCommand(), $this->lng->txt('save_and_back')); if (null !== $this->getSaveAndNewCommand()) { $this->addCommandButton($this->getSaveAndNewCommand(), $this->lng->txt('tst_save_and_create_new_rule')); } $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SHOW_SRC_POOL_DEF_LIST, $this->lng->txt('cancel')); $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id'); $hiddenDefId->setValue($sourcePool->getId()); $this->addItem($hiddenDefId); $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id'); $hiddenPoolId->setValue($sourcePool->getPoolId()); $this->addItem($hiddenPoolId); $nonEditablePoolLabel = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_label'), 'quest_pool_label'); $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng)); $this->addItem($nonEditablePoolLabel); if (count($availableTaxonomyIds)) { $taxRadio = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax'); $taxRadio->setRequired(true); $taxRadio->addOption(new ilRadioOption($this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0)); $taxRadio->setValue(0); require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php'; foreach ($availableTaxonomyIds as $taxId) { $taxonomy = new ilObjTaxonomy($taxId); $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle()); $taxRadioOption = new ilRadioOption($label, $taxId); $taxRadio->addOption($taxRadioOption); $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_{$taxId}", false); $taxSelect->setRequired(true); $taxRadioOption->addSubItem($taxSelect); if ($taxId == $sourcePool->getOriginalFilterTaxId()) { $taxRadio->setValue($sourcePool->getOriginalFilterTaxId()); $taxSelect->setValue($sourcePool->getOriginalFilterTaxNodeId()); } } $this->addItem($taxRadio); } else { $hiddenNoTax = new ilHiddenInputGUI('filter_tax'); $hiddenNoTax->setValue(0); $this->addItem($hiddenNoTax); $nonEditableNoTax = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'no_tax_label'); $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint')); $this->addItem($nonEditableNoTax); } if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) { $questionAmountPerSourcePool = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_source_pool'), 'question_amount_per_pool'); $questionAmountPerSourcePool->setRequired(true); $questionAmountPerSourcePool->allowDecimals(false); $questionAmountPerSourcePool->setMinValue(0); $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true); $questionAmountPerSourcePool->setSize(4); if ($sourcePool->getQuestionAmount()) { $questionAmountPerSourcePool->setValue($sourcePool->getQuestionAmount()); } $this->addItem($questionAmountPerSourcePool); } }
/** * Delete taxonomy nodes */ function confirmedDelete() { global $ilCtrl; include_once "./Services/Taxonomy/classes/class.ilTaxonomyNode.php"; // delete all selected objects foreach ($_POST["id"] as $id) { $node = new ilTaxonomyNode($id); $tax = new ilObjTaxonomy($node->getTaxonomyId()); $tax_tree = $tax->getTree(); $node_data = $tax_tree->getNodeData($id); if (is_object($node)) { $node->delete(); } if ($tax_tree->isInTree($id)) { $tax_tree->deleteTree($node_data); } ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]); } // feedback ilUtil::sendInfo($this->lng->txt("info_deleted"), true); $ilCtrl->redirect($this, "listItems"); }
/** * 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()); }
/** * 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()); }
/** * 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"))); } } }
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; }
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; }
/** * Clone glossary * * @param int target ref_id * @param int copy id */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilUser, $ilias; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); $this->cloneMetaData($new_obj); //copy online status if object is not the root copy object $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id); if (!$cp_options->isRootNode($this->getRefId())) { $new_obj->setOnline($this->getOnline()); } // $new_obj->setTitle($this->getTitle()); $new_obj->setDescription($this->getDescription()); $new_obj->setVirtualMode($this->getVirtualMode()); $new_obj->setPresentationMode($this->getPresentationMode()); $new_obj->setSnippetLength($this->getSnippetLength()); $new_obj->update(); // set/copy stylesheet include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $style_id = $this->getStyleSheetId(); if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) { $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id); $new_id = $style_obj->ilClone(); $new_obj->setStyleSheetId($new_id); $new_obj->update(); } // copy taxonomy if (($tax_id = $this->getTaxonomyId()) > 0) { // clone it include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; $tax = new ilObjTaxonomy($tax_id); $new_tax = $tax->cloneObject(0, 0, true); $map = $tax->getNodeMapping(); // assign new taxonomy to new glossary ilObjTaxonomy::saveUsage($new_tax->getId(), $new_obj->getId()); } // assign new tax/new glossary // handle mapping // prepare tax node assignments objects include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php"; if ($tax_id > 0) { $tax_ass = new ilTaxNodeAssignment("glo", $this->getId(), "term", $tax_id); $new_tax_ass = new ilTaxNodeAssignment("glo", $new_obj->getId(), "term", $new_tax->getId()); } // copy terms foreach (ilGlossaryTerm::getTermList($this->getId()) as $term) { $new_term_id = ilGlossaryTerm::_copyTerm($term["id"], $new_obj->getId()); // copy tax node assignments if ($tax_id > 0) { $assignmts = $tax_ass->getAssignmentsOfItem($term["id"]); foreach ($assignmts as $a) { if ($map[$a["node_id"]] > 0) { $new_tax_ass->addAssignment($map[$a["node_id"]], $new_term_id); } } } } return $new_obj; }
/** * 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; } } }
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; }
protected function populateTaxonomyFormSection(ilPropertyFormGUI $form) { if (count($this->getTaxonomyIds())) { $sectHeader = new ilFormSectionHeaderGUI(); $sectHeader->setTitle($this->lng->txt('qpl_qst_edit_form_taxonomy_section')); $form->addItem($sectHeader); require_once 'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php'; foreach ($this->getTaxonomyIds() as $taxonomyId) { $taxonomy = new ilObjTaxonomy($taxonomyId); $label = sprintf($this->lng->txt('qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle()); $postvar = "tax_node_assign_{$taxonomyId}"; $taxNodeAssign = new ilTaxAssignInputGUI($taxonomy->getId(), true, $label, $postvar); // TODO: determine tst/qpl when tax assigns become maintainable within tests $taxNodeAssign->setCurrentValues('qpl', $this->object->getObjId(), 'quest', $this->object->getId()); $form->addItem($taxNodeAssign); } } }
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); } } } } } } } } }
/** * 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; }
/** * 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() . " "); } } }