ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilContSkillMemberTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
15{
19 protected $ctrl;
20
24 protected $lng;
25
29 protected $tpl;
30
35
39 protected $ui;
40
44 public function __construct($a_parent_obj, $a_parent_cmd, ilContainerSkills $a_cont_skills)
45 {
46 global $DIC;
47
48 $this->ctrl = $DIC->ctrl();
49 $this->lng = $DIC->language();
50 $this->tpl = $DIC["tpl"];
51 $this->ui = $DIC->ui();
52
53 $this->setId("cont_skll_mem_" . $a_cont_skills->getId());
54
55 include_once("./Services/Skill/classes/class.ilSkillTree.php");
56 $this->skill_tree = new ilSkillTree();
57
58 $this->container_skills = $a_cont_skills;
59
60 parent::__construct($a_parent_obj, $a_parent_cmd);
61 $this->setData($this->getMembers());
62 $this->setTitle($this->lng->txt("cont_cont_skills"));
63
64 $this->addColumn("", "", "1", true);
65 $this->addColumn($this->lng->txt("name"), "name");
66 $this->addColumn($this->lng->txt("login"), "login");
67 $this->addColumn($this->lng->txt("cont_mem_skills"), "");
68 $this->addColumn($this->lng->txt("cont_published"), "");
69 $this->addColumn($this->lng->txt("actions"));
70
71 $this->setDefaultOrderField("name");
72 $this->setDefaultOrderDirection("asc");
73 $this->setSelectAllCheckbox("usr_id");
74
75 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
76 $this->setRowTemplate("tpl.cont_member_skill_row.html", "Services/Container/Skills");
77
78 if (ilContainer::_lookupContainerSetting($this->container_skills->getId(), "cont_skill_publish", 0)) {
79 $this->addMultiCommand("publishAssignments", $this->lng->txt("cont_publish_assignment"));
80 }
81 $this->addMultiCommand("deassignCompetencesConfirm", $this->lng->txt("cont_deassign_competence"));
82 }
83
90 public function getMembers()
91 {
92 include_once("./Modules/Course/classes/class.ilCourseParticipants.php");
93 $p = ilCourseParticipants::getInstanceByObjId($this->container_skills->getId());
94
95 $members = array();
96 foreach ($p->getMembers() as $m) {
98 $members[] = array(
99 "id" => $m,
100 "name" => $name["lastname"] . ", " . $name["firstname"],
101 "login" => $name["login"],
102 "skills" => array()
103 );
104 }
105 return $members;
106 }
107
108
112 protected function fillRow($a_set)
113 {
117 $ui = $this->ui;
118
119 // levels
120 include_once("./Services/Container/Skills/classes/class.ilContainerMemberSkills.php");
121 $mskills = new ilContainerMemberSkills($this->container_skills->getId(), $a_set["id"]);
122 foreach ($mskills->getOrderedSkillLevels() as $sk) {
123 $tpl->setCurrentBlock("level");
124 $tpl->setVariable("TXT_SKILL", ilBasicSkill::_lookupTitle($sk["skill_id"], $sk["tref_id"]));
125 $tpl->setVariable("TXT_LEVEL", ilBasicSkill::lookupLevelTitle($sk["level_id"]));
126 $tpl->setVariable("PATH", $this->getParentObject()->getPathString($sk["skill_id"], $sk["tref_id"]));
127 $tpl->parseCurrentBlock();
128 }
129
130 // published
131 if ($mskills->getPublished()) {
132 $tpl->setVariable("PUBLISHED", $lng->txt("yes"));
133 } else {
134 $tpl->setVariable("PUBLISHED", $lng->txt("no"));
135 }
136
137
138 $tpl->setVariable("NAME", $a_set["name"]);
139 $tpl->setVariable("ID", $a_set["id"]);
140 $tpl->setVariable("LOGIN", $a_set["login"]);
141
142 $ctrl->setParameter($this->parent_obj, "usr_id", $a_set["id"]);
143
144 $items = array();
145 $b = $ui->factory()->button();
146 if (!$mskills->getPublished() || (!ilContainer::_lookupContainerSetting($this->container_skills->getId(), "cont_skill_publish", 0))) {
147 $items[] = $b->shy($lng->txt("cont_assign_competence"), $ctrl->getLinkTarget($this->parent_obj, "assignCompetences"));
148 }
149 if (!$mskills->getPublished()) {
150 $items[] = $b->shy($lng->txt("cont_publish_assignment"), $ctrl->getLinkTarget($this->parent_obj, "publishAssignments"));
151 }
152 $items[] = $b->shy($lng->txt("cont_deassign_competence"), $ctrl->getLinkTarget($this->parent_obj, "deassignCompetencesConfirm"));
153 $dd = $ui->factory()->dropdown()->standard($items);
154
155 $tpl->setVariable("ACTIONS", $ui->renderer()->render($dd));
156 }
157}
An exception for terminatinating execution or to throw for unit testing.
static lookupLevelTitle($a_id)
Lookup level title.
TableGUI class for container members / skill assignments.
__construct($a_parent_obj, $a_parent_cmd, ilContainerSkills $a_cont_skills)
Constructor.
Skills of a container.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _lookupName($a_user_id)
lookup user name
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
Class ilTable2GUI.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
global $DIC
Definition: saml.php:7