1<?php 2 3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */ 4 5include_once("./Services/UIComponent/Explorer2/classes/class.ilExplorerSelectInputGUI.php"); 6include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php"); 7 8/** 9 * Select taxonomy nodes input GUI 10 * 11 * @author Alex Killing <alex.killing@gmx.de> 12 * @version $Id$ 13 * @ilCtrl_IsCalledBy ilTaxSelectInputGUI: ilFormPropertyDispatchGUI 14 * 15 * @ingroup ServicesTaxonomy 16 */ 17class ilTaxSelectInputGUI extends ilExplorerSelectInputGUI 18{ 19 /** 20 * Constructor 21 * 22 * @param string $a_title Title 23 * @param string $a_postvar Post Variable 24 */ 25 public function __construct($a_taxonomy_id, $a_postvar, $a_multi = false) 26 { 27 global $DIC; 28 29 $this->lng = $DIC->language(); 30 $this->ctrl = $DIC->ctrl(); 31 $lng = $DIC->language(); 32 $ilCtrl = $DIC->ctrl(); 33 34 $lng->loadLanguageModule("tax"); 35 $this->multi_nodes = $a_multi; 36 include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php"); 37 $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $a_postvar); 38 $this->explorer_gui = new ilTaxonomyExplorerGUI( 39 array("ilformpropertydispatchgui", "iltaxselectinputgui"), 40 $this->getExplHandleCmd(), 41 $a_taxonomy_id, 42 "", 43 "", 44 "tax_expl_" . $a_postvar 45 ); 46 $this->explorer_gui->setSelectMode($a_postvar . "_sel", $this->multi_nodes); 47 $this->explorer_gui->setSkipRootNode(true); 48 49 parent::__construct(ilObject::_lookupTitle($a_taxonomy_id), $a_postvar, $this->explorer_gui, $this->multi_nodes); 50 $this->setType("tax_select"); 51 52 if ((int) $a_taxonomy_id == 0) { 53 throw new ilTaxonomyExceptions("No taxonomy ID passed to ilTaxSelectInputGUI."); 54 } 55 56 $this->setTaxonomyId((int) $a_taxonomy_id); 57 $this->tax = new ilObjTaxonomy($this->getTaxonomyId()); 58 } 59 60 /** 61 * Set taxonomy id 62 * 63 * @param int $a_val taxonomy id 64 */ 65 public function setTaxonomyId($a_val) 66 { 67 $this->taxononmy_id = $a_val; 68 } 69 70 /** 71 * Get taxonomy id 72 * 73 * @return int taxonomy id 74 */ 75 public function getTaxonomyId() 76 { 77 return $this->taxononmy_id; 78 } 79 80 /** 81 * Get title for node id (needs to be overwritten, if explorer is not a tree eplorer 82 * 83 * @param 84 * @return 85 */ 86 public function getTitleForNodeId($a_id) 87 { 88 include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php"); 89 return ilTaxonomyNode::_lookupTitle($a_id); 90 } 91} 92