ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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{
20 protected $user;
21
25 protected $ctrl;
26
27
31 public function __construct(
32 $a_parent_obj,
33 $a_parent_cmd,
34 $a_top_skill_id,
35 $a_tref_id,
36 $a_basic_skill_id
37 ) {
38 global $DIC;
39
40 $this->user = $DIC->user();
41 $this->lng = $DIC->language();
42 $this->ctrl = $DIC->ctrl();
43 $ilUser = $DIC->user();
44
45 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
46 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
47 $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
48 $this->ws_access = new ilWorkspaceAccessHandler();
49
50 $this->top_skill_id = $a_top_skill_id;
51 $this->tref_id = (int) $a_tref_id;
52 $this->basic_skill_id = $a_basic_skill_id;
53
54 // workspace tree
55 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
56 $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
57
58
59 // build title
60 include_once("./Services/Skill/classes/class.ilSkillTree.php");
61 $stree = new ilSkillTree();
62 $path = $stree->getPathFull($this->basic_skill_id);
63 $title = $sep = "";
64 foreach ($path as $p) {
65 if ($p["type"] != "skrt") {
66 $title.= $sep . $p["title"];
67 $sep = " > ";
68 }
69 }
70
71 parent::__construct($a_parent_obj, $a_parent_cmd);
72 $this->setData($this->getLevels());
73 $this->setTitle($title);
74 $this->setLimit(9999);
75
76 $this->addColumn($this->lng->txt("skmg_skill_level"));
77 $this->addColumn($this->lng->txt("description"));
78 $this->addColumn($this->lng->txt("skmg_materials"));
79 $this->addColumn($this->lng->txt("actions"));
80
81 $this->setEnableHeader(true);
82 // $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
83 $this->setRowTemplate("tpl.skill_materials_row.html", "Services/Skill");
84 $this->disable("footer");
85 $this->setEnableTitle(true);
86
87 // $this->addMultiCommand("", $lng->txt(""));
88// $this->addCommandButton("", $lng->txt(""));
89 }
90
97 public function getLevels()
98 {
99 include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
100 $this->skill = ilSkillTreeNodeFactory::getInstance($this->basic_skill_id);
101 foreach ($this->skill->getLevelData() as $k => $v) {
102 $levels[] = $v;
103 }
104
105 return $levels;
106 }
107
111 protected function fillRow($a_set)
112 {
116
117 include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
118 $mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]);
119 $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
120 foreach ($mat as $m) {
121 $this->tpl->setCurrentBlock("mat");
122 $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
123 $this->tpl->setVariable(
124 "MAT_TITLE",
126 );
127 $this->tpl->setVariable(
128 "MAT_IMG",
129 ilUtil::img(ilUtil::getImagePath("icon_" . ilObject::_lookupType($obj_id) . ".svg"))
130 );
131 $this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
132 $ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]);
133 $this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial"));
134
135 $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
136 $url = $this->ws_access->getGotoLink($m["wsp_id"], $obj_id);
137 $this->tpl->setVariable("HREF_MAT", $url);
138 $this->tpl->parseCurrentBlock();
139 }
140
141 $this->tpl->setCurrentBlock("cmd");
142 $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget(
143 $this->parent_obj,
144 "assignMaterial"
145 ));
146 $this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials"));
147 $this->tpl->parseCurrentBlock();
148 $ilCtrl->setParameter($this->parent_obj, "level_id", "");
149
150 $this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
151 $this->tpl->setVariable("SKILL_ID", $this->basic_skill_id);
152 $this->tpl->setVariable("TXT_SKILL", $a_set["title"]);
153 $this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]);
154 }
155}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
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.
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.
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.
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
$url
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18