ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
17  function __construct($a_parent_obj, $a_parent_cmd, ilObjTaxonomyAdministration $a_obj)
18  {
19  global $ilCtrl, $lng, $ilAccess, $lng;
20 
21  $this->obj = $a_obj;
22 
23  $this->setId("tax_adm_repo");
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26 
27  $this->addColumn($this->lng->txt("obj_tax"), "tax_title");
28  $this->addColumn($this->lng->txt("status"), "status");
29  $this->addColumn($this->lng->txt("object"), "obj_title");
30 
31  $this->setDefaultOrderField("tax_title");
32  $this->setDefaultOrderDirection("asc");
33 
34  $this->setRowTemplate("tpl.tax_admin_repo_row.html", "Services/Taxonomy");
35 
36  $this->initItems();
37  }
38 
39  protected function initItems()
40  {
41  $data = array();
42 
43  include_once "Services/Link/classes/class.ilLink.php";
44  foreach($this->obj->getRepositoryTaxonomies() as $tax_id => $objs)
45  {
46  foreach($objs as $obj_id => $obj)
47  {
48  $idx = $tax_id."_".$obj_id;
49  if(!isset($data[$idx]))
50  {
51  $data[$idx] = array(
52  "tax_title" => $obj["tax_title"]
53  ,"obj_title" => $obj["obj_title"]
54  ,"tax_status" => $obj["tax_status"]
55  ,"references" => array()
56  );
57  }
58 
59  $path = $obj["path"];
60  array_pop($path);
61  $path = implode(" &rsaquo; ", $path);
62 
63  $data[$idx]["references"][$obj["ref_id"]] =
64  array(
65  "path"=> $path
66  ,"url" => ilLink::_getLink($obj["ref_id"])
67  );
68  }
69  }
70 
71  $this->setData($data);
72  }
73 
74  protected function fillRow($a_set)
75  {
76  foreach($a_set["references"] as $ref)
77  {
78  $this->tpl->setCurrentBlock("obj_bl");
79  $this->tpl->setVariable("OBJ_TITLE", $a_set["obj_title"]);
80  $this->tpl->setVariable("OBJ_PATH", $ref["path"]);
81  $this->tpl->setVariable("OBJ_URL", $ref["url"]);
82  $this->tpl->parseCurrentBlock();
83  }
84 
85  if($a_set["tax_status"])
86  {
87  $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("active"));
88  $this->tpl->setVariable("TAX_STATUS_COLOR", "smallgreen");
89  }
90  else
91  {
92  $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("inactive"));
93  $this->tpl->setVariable("TAX_STATUS_COLOR", "smallred");
94  }
95 
96  $this->tpl->setVariable("TAX_TITLE", $a_set["tax_title"]);
97  }
98 }
99 
$path
Definition: aliased.php:25
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
global $lng
Definition: privfeed.php:17
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.