ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 include_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 $ilCtrl, $lng, $ilAccess, $lng, $ilUser;
25 
26  $this->top_skill_id = $a_top_skill_id;
27  $this->tref_id = (int) $a_tref_id;
28  $this->basic_skill_id = $a_basic_skill_id;
29 
30  // workspace tree
31  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
32  $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
33 
34 
35  // build title
36  include_once("./Services/Skill/classes/class.ilSkillTree.php");
37  $stree = new ilSkillTree();
38  $path = $stree->getPathFull($this->basic_skill_id);
39  $title = $sep = "";
40  foreach ($path as $p)
41  {
42  if ($p["type"] != "skrt")
43  {
44  $title.= $sep.$p["title"];
45  $sep = " > ";
46  }
47  }
48 
49  parent::__construct($a_parent_obj, $a_parent_cmd);
50  $this->setData($this->getLevels());
51  $this->setTitle($title);
52  $this->setLimit(9999);
53 
54  $this->addColumn($this->lng->txt("skmg_skill_level"));
55  $this->addColumn($this->lng->txt("description"), "", "60%");
56  $this->addColumn($this->lng->txt("skmg_materials"));
57  $this->addColumn($this->lng->txt("actions"));
58 
59  $this->setEnableHeader(true);
60 // $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
61  $this->setRowTemplate("tpl.skill_materials_row.html", "Services/Skill");
62  $this->disable("footer");
63  $this->setEnableTitle(true);
64 
65 // $this->addMultiCommand("", $lng->txt(""));
66 // $this->addCommandButton("", $lng->txt(""));
67  }
68 
75  function getLevels()
76  {
77  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
78  $this->skill = ilSkillTreeNodeFactory::getInstance($this->basic_skill_id);
79  foreach ($this->skill->getLevelData() as $k => $v)
80  {
81  $levels[] = $v;
82  }
83 
84  return $levels;
85  }
86 
90  protected function fillRow($a_set)
91  {
92  global $lng, $ilCtrl, $ilUser;
93 
94  include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
95  $mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]);
96  $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
97  foreach ($mat as $m)
98  {
99  $this->tpl->setCurrentBlock("mat");
100  $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
101  $this->tpl->setVariable("MAT_TITLE",
102  ilObject::_lookupTitle($obj_id));
103  $this->tpl->setVariable("MAT_IMG",
104  ilUtil::img(ilUtil::getImagePath("icon_".ilObject::_lookupType($obj_id)."_s.gif")));
105  $this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
106  $ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]);
107  $this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial"));
108  $this->tpl->parseCurrentBlock();
109  }
110 
111  $this->tpl->setCurrentBlock("cmd");
112  $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj,
113  "assignMaterial"));
114  $this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials"));
115  $this->tpl->parseCurrentBlock();
116  $ilCtrl->setParameter($this->parent_obj, "level_id", "");
117 
118  $this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
119  $this->tpl->setVariable("SKILL_ID", $this->basic_skill_id);
120  $this->tpl->setVariable("TXT_SKILL", $a_set["title"]);
121  $this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]);
122  }
123 
124 }
125 ?>