ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSkillAssignMaterialsTableGUI.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
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
16{
17
21 function __construct($a_parent_obj, $a_parent_cmd, $a_top_skill_id, $a_tref_id,
22 $a_basic_skill_id)
23 {
24 global $ilUser;
25
26 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
27 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
28 $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
29 $this->ws_access = new ilWorkspaceAccessHandler();
30
31 $this->top_skill_id = $a_top_skill_id;
32 $this->tref_id = (int) $a_tref_id;
33 $this->basic_skill_id = $a_basic_skill_id;
34
35 // workspace tree
36 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
37 $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
38
39
40 // build title
41 include_once("./Services/Skill/classes/class.ilSkillTree.php");
42 $stree = new ilSkillTree();
43 $path = $stree->getPathFull($this->basic_skill_id);
44 $title = $sep = "";
45 foreach ($path as $p)
46 {
47 if ($p["type"] != "skrt")
48 {
49 $title.= $sep.$p["title"];
50 $sep = " > ";
51 }
52 }
53
54 parent::__construct($a_parent_obj, $a_parent_cmd);
55 $this->setData($this->getLevels());
56 $this->setTitle($title);
57 $this->setLimit(9999);
58
59 $this->addColumn($this->lng->txt("skmg_skill_level"));
60 $this->addColumn($this->lng->txt("description"), "", "60%");
61 $this->addColumn($this->lng->txt("skmg_materials"));
62 $this->addColumn($this->lng->txt("actions"));
63
64 $this->setEnableHeader(true);
65// $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
66 $this->setRowTemplate("tpl.skill_materials_row.html", "Services/Skill");
67 $this->disable("footer");
68 $this->setEnableTitle(true);
69
70// $this->addMultiCommand("", $lng->txt(""));
71// $this->addCommandButton("", $lng->txt(""));
72 }
73
80 function getLevels()
81 {
82 include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
83 $this->skill = ilSkillTreeNodeFactory::getInstance($this->basic_skill_id);
84 foreach ($this->skill->getLevelData() as $k => $v)
85 {
86 $levels[] = $v;
87 }
88
89 return $levels;
90 }
91
95 protected function fillRow($a_set)
96 {
97 global $lng, $ilCtrl, $ilUser;
98
99 include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
100 $mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]);
101 $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
102 foreach ($mat as $m)
103 {
104 $this->tpl->setCurrentBlock("mat");
105 $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
106 $this->tpl->setVariable("MAT_TITLE",
107 ilObject::_lookupTitle($obj_id));
108 $this->tpl->setVariable("MAT_IMG",
109 ilUtil::img(ilUtil::getImagePath("icon_".ilObject::_lookupType($obj_id).".svg")));
110 $this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
111 $ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]);
112 $this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial"));
113
114 $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
115 $url = $this->ws_access->getGotoLink($m["wsp_id"], $obj_id);
116 $this->tpl->setVariable("HREF_MAT", $url);
117 $this->tpl->parseCurrentBlock();
118 }
119
120 $this->tpl->setCurrentBlock("cmd");
121 $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj,
122 "assignMaterial"));
123 $this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials"));
124 $this->tpl->parseCurrentBlock();
125 $ilCtrl->setParameter($this->parent_obj, "level_id", "");
126
127 $this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
128 $this->tpl->setVariable("SKILL_ID", $this->basic_skill_id);
129 $this->tpl->setVariable("TXT_SKILL", $a_set["title"]);
130 $this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]);
131 }
132
133}
134?>
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static getAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
Assign materials to skill levels table.
__construct($a_parent_obj, $a_parent_cmd, $a_top_skill_id, $a_tref_id, $a_basic_skill_id)
Constructor.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
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
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
disable($a_module_name)
diesables particular modules of table
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Access handler for personal workspace.
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72
$path
Definition: index.php:22
global $ilUser
Definition: imgupload.php:15