ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTaxonomyAdministrationRepositoryTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  protected $access;
21 
22  public function __construct($a_parent_obj, $a_parent_cmd, ilObjTaxonomyAdministration $a_obj)
23  {
24  global $DIC;
25 
26  $this->ctrl = $DIC->ctrl();
27  $this->lng = $DIC->language();
28  $this->access = $DIC->access();
29  $ilCtrl = $DIC->ctrl();
30  $lng = $DIC->language();
31  $ilAccess = $DIC->access();
32  $lng = $DIC->language();
33 
34  $this->obj = $a_obj;
35 
36  $this->setId("tax_adm_repo");
37 
38  parent::__construct($a_parent_obj, $a_parent_cmd);
39 
40  $this->addColumn($this->lng->txt("obj_tax"), "tax_title");
41  $this->addColumn($this->lng->txt("status"), "status");
42  $this->addColumn($this->lng->txt("object"), "obj_title");
43 
44  $this->setDefaultOrderField("tax_title");
45  $this->setDefaultOrderDirection("asc");
46 
47  $this->setRowTemplate("tpl.tax_admin_repo_row.html", "Services/Taxonomy");
48 
49  $this->initItems();
50  }
51 
52  protected function initItems()
53  {
54  $data = array();
55 
56  include_once "Services/Link/classes/class.ilLink.php";
57  foreach ($this->obj->getRepositoryTaxonomies() as $tax_id => $objs) {
58  foreach ($objs as $obj_id => $obj) {
59  $idx = $tax_id . "_" . $obj_id;
60  if (!isset($data[$idx])) {
61  $data[$idx] = array(
62  "tax_title" => $obj["tax_title"]
63  ,"obj_title" => $obj["obj_title"]
64  ,"tax_status" => $obj["tax_status"]
65  ,"references" => array()
66  );
67  }
68 
69  $path = $obj["path"];
70  array_pop($path);
71  $path = implode(" &rsaquo; ", $path);
72 
73  $data[$idx]["references"][$obj["ref_id"]] =
74  array(
75  "path"=> $path
76  ,"url" => ilLink::_getLink($obj["ref_id"])
77  );
78  }
79  }
80 
81  $this->setData($data);
82  }
83 
84  protected function fillRow($a_set)
85  {
86  foreach ($a_set["references"] as $ref) {
87  $this->tpl->setCurrentBlock("obj_bl");
88  $this->tpl->setVariable("OBJ_TITLE", $a_set["obj_title"]);
89  $this->tpl->setVariable("OBJ_PATH", $ref["path"]);
90  $this->tpl->setVariable("OBJ_URL", $ref["url"]);
91  $this->tpl->parseCurrentBlock();
92  }
93 
94  if ($a_set["tax_status"]) {
95  $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("active"));
96  $this->tpl->setVariable("TAX_STATUS_COLOR", "smallgreen");
97  } else {
98  $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("inactive"));
99  $this->tpl->setVariable("TAX_STATUS_COLOR", "smallred");
100  }
101 
102  $this->tpl->setVariable("TAX_TITLE", $a_set["tax_title"]);
103  }
104 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
setId($a_val)
Set id.
__construct($a_parent_obj, $a_parent_cmd, ilObjTaxonomyAdministration $a_obj)
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.