ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLicenseOverviewTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
16 
20  protected $item_list_guis = array();
21 
22 
31  public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, ilObjectGUI $a_parent_gui)
32  {
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 
35  $this->setId("licovw");
36  $this->setTitle($this->lng->txt("licenses"));
37 
38  $this->addColumn($this->lng->txt("title"), "title");
39  $this->addColumn($this->lng->txt("comment"));
40  $this->addColumn($this->lng->txt("existing_licenses"), "existing");
41  $this->addColumn($this->lng->txt("used_licenses"), "used");
42  $this->addColumn($this->lng->txt("remaining_licenses"), "remaining");
43  $this->addColumn($this->lng->txt("potential_accesses"), "potential");
44 
45  $this->setDefaultOrderField("title");
46  $this->setDefaultOrderDirection("ASC");
47 
48  $this->setRowTemplate("tpl.lic_show_licenses.html", "Services/License");
49 
50  $this->getItems($a_mode, $a_parent_gui);
51  }
52 
53 
58  protected function getItems($a_mode, ilObjectGUI $a_parent_gui)
59  {
60  $data = array();
61 
63  $objects = ilLicense::_getLicensedObjects();
64  } else {
65  $objects = ilLicense::_getLicensedChildObjects($a_parent_gui->object->getRefId());
66  }
67  foreach ($objects as $item) {
68  $license = new ilLicense($item["obj_id"]);
69 
70  $remaining_licenses = ($license->getLicenses() == "0") ? $this->lng->txt("arbitrary") : $license->getRemainingLicenses();
71 
72  $data[] = array(
73  "title" => $item["title"],
74  "comment" => nl2br(trim($license->getRemarks())),
75  "existing" => $license->getLicenses(),
76  "used" => $license->getAccesses(),
77  "remaining" => $remaining_licenses,
78  "potential" => $license->getPotentialAccesses(),
79  "listGUI" => $this->getItemHTML($item),
80  );
81  }
82 
83  $this->setData($data);
84  }
85 
86 
90  protected function fillRow($a_set)
91  {
92  $this->tpl->setVariable("TITLE", $a_set["listGUI"]);
93  $this->tpl->setVariable("REMARKS", $a_set["comment"]);
94  $this->tpl->setVariable("LICENSES", $a_set["existing"]);
95  $this->tpl->setVariable("USED_LICENSES", $a_set["used"]);
96  $this->tpl->setVariable("REMAINING_LICENSES", $a_set["remaining"]);
97  $this->tpl->setVariable("POTENTIAL_ACCESSES", $a_set["potential"]);
98  }
99 
100 
105  protected function getItemHTML($item = array())
106  {
107  $item_list_gui = $this->getItemListGUI($item["type"]);
108  $item_list_gui->enableCommands(true);
109  $item_list_gui->enableDelete(false);
110  $item_list_gui->enableCut(false);
111  $item_list_gui->enableCopy(false);
112  $item_list_gui->enableLink(false);
113  $item_list_gui->enableProperties(false);
114  $item_list_gui->enableDescription(false);
115  $item_list_gui->enablePreconditions(false);
116  $item_list_gui->enableSubscribe(false);
117  $item_list_gui->enableInfoScreen(false);
118 
119  return $item_list_gui->getListItemHTML($item["ref_id"], $item["obj_id"], $item["title"], $item["description"]);
120  }
121 
122 
127  protected function getItemListGUI($a_type)
128  {
129  global $objDefinition;
130 
131  if (!is_object($this->item_list_guis[$a_type])) {
132  $class = $objDefinition->getClassName($a_type);
133  $location = $objDefinition->getLocation($a_type);
134  $full_class = "ilObj" . $class . "ListGUI";
135  include_once($location . "/class." . $full_class . ".php");
136  $item_list_gui = new $full_class();
137  $this->item_list_guis[$a_type] = $item_list_gui;
138  } else {
139  $item_list_gui = $this->item_list_guis[$a_type];
140  }
141 
142  return $item_list_gui;
143  }
144 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$location
Definition: buildRTE.php:44
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
$a_type
Definition: workflow.php:92
Class ilTable2GUI.
Class ilObjectGUI Basic methods of all Output classes.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
__construct($a_parent_obj, $a_parent_cmd, $a_mode, ilObjectGUI $a_parent_gui)
ilLicenseOverviewTableGUI constructor.
static _getLicensedObjects()
Get a list of all objects with activated licensing.
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.
getItems($a_mode, ilObjectGUI $a_parent_gui)
static _getLicensedChildObjects($a_ref_id)
Get a list of all sub objects with activated licensing.