ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
16 protected $item_list_guis; // [array]
17
18 function __construct($a_parent_obj, $a_parent_cmd, $a_mode, ilObjectGUI $a_parent_gui)
19 {
20 parent::__construct($a_parent_obj, $a_parent_cmd);
21
22 $this->setId("licovw");
23 $this->setTitle($this->lng->txt("licenses"));
24
25 $this->addColumn($this->lng->txt("title"), "title");
26 $this->addColumn($this->lng->txt("comment"));
27 $this->addColumn($this->lng->txt("existing_licenses"), "existing");
28 $this->addColumn($this->lng->txt("used_licenses"), "used");
29 $this->addColumn($this->lng->txt("remaining_licenses"), "remaining");
30 $this->addColumn($this->lng->txt("potential_accesses"), "potential");
31
32 $this->setDefaultOrderField("title");
33 $this->setDefaultOrderDirection("ASC");
34
35 $this->setRowTemplate("tpl.lic_show_licenses.html", "Services/License");
36
37 $this->getItems($a_mode, $a_parent_gui);
38 }
39
40 protected function getItems($a_mode, ilObjectGUI $a_parent_gui)
41 {
42 $data = array();
43
45 {
47 }
48 else
49 {
50 $objects = ilLicense::_getLicensedChildObjects($a_parent_gui->object->getRefId());
51 }
52 foreach($objects as $item)
53 {
54 $license = new ilLicense($item["obj_id"]);
55
56 $remaining_licenses = ($license->getLicenses() == "0")
57 ? $this->lng->txt("arbitrary")
58 : $license->getRemainingLicenses();
59
60 $data[] = array(
61 "title" => $item["title"]
62 ,"comment" => nl2br(trim($license->getRemarks()))
63 ,"existing" => $license->getLicenses()
64 ,"used" => $license->getAccesses()
65 ,"remaining" => $remaining_licenses
66 ,"potential" => $license->getPotentialAccesses()
67 ,"listGUI" => $this->getItemHTML($item)
68 );
69 }
70
71 $this->setData($data);
72 }
73
77 protected function fillRow($a_set)
78 {
79 $this->tpl->setVariable("TITLE", $a_set["listGUI"]);
80 $this->tpl->setVariable("REMARKS", $a_set["comment"]);
81 $this->tpl->setVariable("LICENSES", $a_set["existing"]);
82 $this->tpl->setVariable("USED_LICENSES", $a_set["used"]);
83 $this->tpl->setVariable("REMAINING_LICENSES", $a_set["remaining"]);
84 $this->tpl->setVariable("POTENTIAL_ACCESSES", $a_set["potential"]);
85 }
86
90 protected function getItemHTML($item = array())
91 {
92 $item_list_gui =& $this->getItemListGUI($item["type"]);
93 $item_list_gui->enableCommands(true);
94 $item_list_gui->enableDelete(false);
95 $item_list_gui->enableCut(false);
96 $item_list_gui->enableCopy(false);
97 $item_list_gui->enablePayment(false);
98 $item_list_gui->enableLink(false);
99 $item_list_gui->enableProperties(false);
100 $item_list_gui->enableDescription(false);
101 $item_list_gui->enablePreconditions(false);
102 $item_list_gui->enableSubscribe(false);
103 $item_list_gui->enableInfoScreen(false);
104
105 return $item_list_gui->getListItemHTML($item["ref_id"],
106 $item["obj_id"], $item["title"], $item["description"]);
107 }
108
112 protected function getItemListGUI($a_type)
113 {
114 global $objDefinition;
115
116 if (!is_object($this->item_list_guis[$a_type]))
117 {
118 $class = $objDefinition->getClassName($a_type);
119 $location = $objDefinition->getLocation($a_type);
120 $full_class = "ilObj".$class."ListGUI";
121 include_once($location."/class.".$full_class.".php");
122 $item_list_gui = new $full_class();
123 $this->item_list_guis[$a_type] =& $item_list_gui;
124 }
125 else
126 {
127 $item_list_gui =& $this->item_list_guis[$a_type];
128 }
129 return $item_list_gui;
130 }
131}
$location
Definition: buildRTE.php:44
getItemHTML($item=array())
get the html code for the list items
getItems($a_mode, ilObjectGUI $a_parent_gui)
__construct($a_parent_obj, $a_parent_cmd, $a_mode, ilObjectGUI $a_parent_gui)
getItemListGUI($a_type)
get item list gui class for type
_getLicensedObjects()
Get a list of all objects with activated licensing.
_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.