/**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_node_id, $a_tax, $a_comp_id, $a_obj_id, $a_item_type, $a_info_obj)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->setId("tax_ass_it");
     $this->setLimit(9999);
     $this->tax = $a_tax;
     $this->node_id = $a_node_id;
     $this->comp_id = $a_comp_id;
     $this->obj_id = $a_obj_id;
     $this->item_type = $a_item_type;
     $this->info_obj = $a_info_obj;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
     $tax_ass = new ilTaxNodeAssignment($this->comp_id, $this->obj_id, $this->item_type, $this->tax->getId());
     $this->setData($tax_ass->getAssignmentsOfNode($this->node_id));
     $this->setTitle($lng->txt("tax_assigned_items"));
     $this->addColumn($this->lng->txt("tax_order"));
     $this->setDefaultOrderField("order_nr");
     $this->setDefaultOrderDirection("asc");
     $this->addColumn($this->lng->txt("title"));
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.tax_ass_items_row.html", "Services/Taxonomy");
     $this->addCommandButton("saveAssignedItemsSorting", $lng->txt("save"));
 }
Ejemplo n.º 2
0
 /**
  * Get all assigned items under a node
  *
  * @param
  * @return
  */
 static function getSubTreeItems($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
 {
     include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php";
     $tree = new ilTaxonomyTree($a_tax_id);
     $sub_nodes = $tree->getSubTreeIds($a_node);
     $sub_nodes[] = $a_node;
     include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
     $tn_ass = new ilTaxNodeAssignment($a_comp, $a_obj_id, $a_item_type, $a_tax_id);
     $items = $tn_ass->getAssignmentsOfNode($sub_nodes);
     return $items;
 }
 private function getTaxonomyFilterExpressions()
 {
     $expressions = array();
     require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
     require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
     foreach ($this->getTaxonomyFilters() as $taxId => $taxNodes) {
         $questionIds = array();
         $forceBypass = true;
         foreach ($taxNodes as $taxNode) {
             $forceBypass = false;
             $taxTree = new ilTaxonomyTree($taxId);
             $taxNodeAssignment = new ilTaxNodeAssignment('tst', $this->getTestObjId(), 'quest', $taxId);
             $subNodes = $taxTree->getSubTreeIds($taxNode);
             $subNodes[] = $taxNode;
             $taxItems = $taxNodeAssignment->getAssignmentsOfNode($subNodes);
             foreach ($taxItems as $taxItem) {
                 $questionIds[$taxItem['item_id']] = $taxItem['item_id'];
             }
         }
         if (!$forceBypass) {
             $expressions[] = $this->db->in('question_id', $questionIds, false, 'integer');
         }
     }
     return $expressions;
 }