ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5
15
19 protected $item_list_guis = array();
20
21
30 public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, ilObjectGUI $a_parent_gui) {
31 parent::__construct($a_parent_obj, $a_parent_cmd);
32
33 $this->setId("licovw");
34 $this->setTitle($this->lng->txt("licenses"));
35
36 $this->addColumn($this->lng->txt("title"), "title");
37 $this->addColumn($this->lng->txt("comment"));
38 $this->addColumn($this->lng->txt("existing_licenses"), "existing");
39 $this->addColumn($this->lng->txt("used_licenses"), "used");
40 $this->addColumn($this->lng->txt("remaining_licenses"), "remaining");
41 $this->addColumn($this->lng->txt("potential_accesses"), "potential");
42
43 $this->setDefaultOrderField("title");
44 $this->setDefaultOrderDirection("ASC");
45
46 $this->setRowTemplate("tpl.lic_show_licenses.html", "Services/License");
47
48 $this->getItems($a_mode, $a_parent_gui);
49 }
50
51
56 protected function getItems($a_mode, ilObjectGUI $a_parent_gui) {
57 $data = array();
58
61 } else {
62 $objects = ilLicense::_getLicensedChildObjects($a_parent_gui->object->getRefId());
63 }
64 foreach ($objects as $item) {
65 $license = new ilLicense($item["obj_id"]);
66
67 $remaining_licenses = ($license->getLicenses() == "0") ? $this->lng->txt("arbitrary") : $license->getRemainingLicenses();
68
69 $data[] = array(
70 "title" => $item["title"],
71 "comment" => nl2br(trim($license->getRemarks())),
72 "existing" => $license->getLicenses(),
73 "used" => $license->getAccesses(),
74 "remaining" => $remaining_licenses,
75 "potential" => $license->getPotentialAccesses(),
76 "listGUI" => $this->getItemHTML($item),
77 );
78 }
79
80 $this->setData($data);
81 }
82
83
87 protected function fillRow($a_set) {
88 $this->tpl->setVariable("TITLE", $a_set["listGUI"]);
89 $this->tpl->setVariable("REMARKS", $a_set["comment"]);
90 $this->tpl->setVariable("LICENSES", $a_set["existing"]);
91 $this->tpl->setVariable("USED_LICENSES", $a_set["used"]);
92 $this->tpl->setVariable("REMAINING_LICENSES", $a_set["remaining"]);
93 $this->tpl->setVariable("POTENTIAL_ACCESSES", $a_set["potential"]);
94 }
95
96
101 protected function getItemHTML($item = array()) {
102 $item_list_gui = $this->getItemListGUI($item["type"]);
103 $item_list_gui->enableCommands(true);
104 $item_list_gui->enableDelete(false);
105 $item_list_gui->enableCut(false);
106 $item_list_gui->enableCopy(false);
107 $item_list_gui->enableLink(false);
108 $item_list_gui->enableProperties(false);
109 $item_list_gui->enableDescription(false);
110 $item_list_gui->enablePreconditions(false);
111 $item_list_gui->enableSubscribe(false);
112 $item_list_gui->enableInfoScreen(false);
113
114 return $item_list_gui->getListItemHTML($item["ref_id"], $item["obj_id"], $item["title"], $item["description"]);
115 }
116
117
122 protected function getItemListGUI($a_type) {
123 global $objDefinition;
124
125 if (!is_object($this->item_list_guis[$a_type])) {
126 $class = $objDefinition->getClassName($a_type);
127 $location = $objDefinition->getLocation($a_type);
128 $full_class = "ilObj" . $class . "ListGUI";
129 include_once($location . "/class." . $full_class . ".php");
130 $item_list_gui = new $full_class();
131 $this->item_list_guis[$a_type] = $item_list_gui;
132 } else {
133 $item_list_gui = $this->item_list_guis[$a_type];
134 }
135
136 return $item_list_gui;
137 }
138}
$location
Definition: buildRTE.php:44
An exception for terminatinating execution or to throw for unit testing.
getItems($a_mode, ilObjectGUI $a_parent_gui)
__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.
static _getLicensedChildObjects($a_ref_id)
Get a list of all sub objects with activated licensing.
Class ilObjectGUI Basic methods of all Output classes.
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
$a_type
Definition: workflow.php:93