ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilSkillLevelTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6include_once("./Services/Link/classes/class.ilLink.php");
7
17{
18
22 function __construct($a_skill_id, $a_parent_obj, $a_parent_cmd, $a_tref_id = 0)
23 {
24 global $ilCtrl, $lng, $ilAccess, $lng;
25
26 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
27 $this->skill_id = $a_skill_id;
28 $this->skill = new ilBasicSkill($a_skill_id);
29 $this->tref_id = $a_tref_id;
30
31 parent::__construct($a_parent_obj, $a_parent_cmd);
32 $this->setLimit(9999);
33 $this->setData($this->getSkillLevelData());
34 $this->setTitle($lng->txt("skmg_skill_levels"));
35 if ($this->tref_id == 0)
36 {
37 $this->setDescription($lng->txt("skmg_from_lower_to_higher_levels"));
38 }
39
40 if ($this->tref_id == 0)
41 {
42 $this->addColumn("", "", "1", true);
43 $this->addColumn($this->lng->txt("skmg_nr"));
44 }
45 $this->addColumn($this->lng->txt("title"));
46 $this->addColumn($this->lng->txt("description"));
47// $this->addColumn($this->lng->txt("skmg_trigger"));
48// $this->addColumn($this->lng->txt("skmg_certificate"))
49 $this->addColumn($this->lng->txt("resources"));
50 $this->addColumn($this->lng->txt("actions"));
51 $this->setDefaultOrderField("nr");
52 $this->setDefaultOrderDirection("asc");
53
54 $this->setEnableHeader(true);
55 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56 $this->setRowTemplate("tpl.skill_level_row.html", "Services/Skill");
57 $this->setEnableTitle(true);
58
59 if ($this->tref_id == 0)
60 {
61 $this->addMultiCommand("confirmLevelDeletion", $lng->txt("delete"));
62 if (count($this->getData()) > 0)
63 {
64 $this->addCommandButton("updateLevelOrder", $lng->txt("skmg_update_order"));
65 }
66 }
67 }
68
74 function numericOrdering($a_field)
75 {
76 if ($a_field == "nr")
77 {
78 return true;
79 }
80 return false;
81 }
82
90 {
91 $levels = $this->skill->getLevelData();
92
93 // add ressource data
94 $res = array();
95 include_once("./Services/Skill/classes/class.ilSkillResources.php");
96 $resources = new ilSkillResources($this->skill_id, $this->tref_id);
97 foreach($resources->getResources() as $level_id => $item)
98 {
99 $res[$level_id] = array_keys($item);
100 }
101
102 foreach($levels as $idx => $item)
103 {
104 $levels[$idx]["ressources"] = $res[$item["id"]];
105 }
106
107 return $levels;
108 }
109
113 protected function fillRow($a_set)
114 {
115 global $lng, $ilCtrl;
116
117 if ($this->tref_id == 0)
118 {
119 $this->tpl->setCurrentBlock("cb");
120 $this->tpl->setVariable("CB_ID", $a_set["id"]);
121 $this->tpl->parseCurrentBlock();
122
123 $this->tpl->setCurrentBlock("nr");
124 $this->tpl->setVariable("ORD_ID", $a_set["id"]);
125 $this->tpl->setVariable("VAL_NR", ((int) $a_set["nr"]) * 10);
126 $this->tpl->parseCurrentBlock();
127
128 }
129
130 $this->tpl->setCurrentBlock("cmd");
131 $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
132 $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
133 if ($this->tref_id == 0)
134 {
135 $this->tpl->setVariable("HREF_CMD",
136 $ilCtrl->getLinkTarget($this->parent_obj, "editLevel"));
137 }
138 else
139 {
140 $this->tpl->setVariable("HREF_CMD",
141 $ilCtrl->getLinkTarget($this->parent_obj, "showLevelResources"));
142 }
143 $this->tpl->parseCurrentBlock();
144
145 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
146 $this->tpl->setVariable("TXT_DESCRIPTION", $a_set["description"]);
147/* $this->tpl->setVariable("TXT_CERTIFICATE",
148 ilBasicSkill::_lookupCertificate($this->skill->getId(),
149 $a_set["id"])
150 ? $lng->txt("yes")
151 : $lng->txt("no"));*/
152
153/* $trigger = ilBasicSkill::lookupLevelTrigger((int) $a_set["id"]);
154 if (ilObject::_lookupType($trigger["obj_id"]) != "crs" ||
155 ilObject::_isInTrash($trigger["ref_id"]))
156 {
157 $trigger = array();
158 }
159
160 // trigger
161 if ($trigger["obj_id"] > 0)
162 {
163 $this->tpl->setVariable("TXT_TRIGGER",
164 ilObject::_lookupTitle($trigger["obj_id"]));
165 }*/
166
167 if(is_array($a_set["ressources"]))
168 {
169 $this->tpl->setCurrentBlock("ressource_bl");
170 foreach($a_set["ressources"] as $rref_id)
171 {
172 $robj_id = ilObject::_lookupObjId($rref_id);
173 $this->tpl->setVariable("RSRC_IMG", ilUtil::img(ilObject::_getIcon($robj_id, "tiny")));
174 $this->tpl->setVariable("RSRC_TITLE", ilObject::_lookupTitle($robj_id));
175 $this->tpl->setVariable("RSRC_URL", ilLink::_getStaticLink($rref_id));
176 $this->tpl->parseCurrentBlock();
177 }
178 }
179 }
180
181}
182?>
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
fillRow($a_set)
Fill table row.
getSkillLevelData()
Get skill level data.
__construct($a_skill_id, $a_parent_obj, $a_parent_cmd, $a_tref_id=0)
Constructor.
numericOrdering($a_field)
Should this field be sorted numeric?
Manages resources for skills.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setDescription($a_val)
Set description.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setLimit($a_limit=0, $a_default_limit=0)
set max.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40