ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $this->skill_tree = new ilSkillTree();
56
57 $this->container_skills = $a_cont_skills;
58
59 parent::__construct($a_parent_obj, $a_parent_cmd);
60 $this->setData($this->getMembers());
61 $this->setTitle($this->lng->txt("cont_cont_skills"));
62
63 $this->addColumn("", "", "1", true);
64 $this->addColumn($this->lng->txt("name"), "name");
65 $this->addColumn($this->lng->txt("login"), "login");
66 $this->addColumn($this->lng->txt("cont_mem_skills"), "");
67 $this->addColumn($this->lng->txt("cont_published"), "");
68 $this->addColumn($this->lng->txt("actions"));
69
70 $this->setDefaultOrderField("name");
71 $this->setDefaultOrderDirection("asc");
72 $this->setSelectAllCheckbox("usr_id");
73
74 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
75 $this->setRowTemplate("tpl.cont_member_skill_row.html", "Services/Container/Skills");
76
77 if (ilContainer::_lookupContainerSetting($this->container_skills->getId(), "cont_skill_publish", 0)) {
78 $this->addMultiCommand("publishAssignments", $this->lng->txt("cont_publish_assignment"));
79 }
80 $this->addMultiCommand("deassignCompetencesConfirm", $this->lng->txt("cont_deassign_competence"));
81 }
82
89 public function getMembers()
90 {
91 include_once("./Modules/Course/classes/class.ilCourseParticipants.php");
92 $p = ilCourseParticipants::getInstanceByObjId($this->container_skills->getId());
93
94 $members = array();
95 foreach ($p->getMembers() as $m) {
97 $members[] = array(
98 "id" => $m,
99 "name" => $name["lastname"] . ", " . $name["firstname"],
100 "login" => $name["login"],
101 "skills" => array()
102 );
103 }
104 return $members;
105 }
106
107
111 protected function fillRow($a_set)
112 {
116 $ui = $this->ui;
117
118 // levels
119 include_once("./Services/Container/Skills/classes/class.ilContainerMemberSkills.php");
120 $mskills = new ilContainerMemberSkills($this->container_skills->getId(), $a_set["id"]);
121 foreach ($mskills->getOrderedSkillLevels() as $sk) {
122 $tpl->setCurrentBlock("level");
123 $tpl->setVariable("TXT_SKILL", ilBasicSkill::_lookupTitle($sk["skill_id"], $sk["tref_id"]));
124 $tpl->setVariable("TXT_LEVEL", ilBasicSkill::lookupLevelTitle($sk["level_id"]));
125 $tpl->setVariable("PATH", $this->getParentObject()->getPathString($sk["skill_id"], $sk["tref_id"]));
126 $tpl->parseCurrentBlock();
127 }
128
129 // published
130 if ($mskills->getPublished()) {
131 $tpl->setVariable("PUBLISHED", $lng->txt("yes"));
132 } else {
133 $tpl->setVariable("PUBLISHED", $lng->txt("no"));
134 }
135
136
137 $tpl->setVariable("NAME", $a_set["name"]);
138 $tpl->setVariable("ID", $a_set["id"]);
139 $tpl->setVariable("LOGIN", $a_set["login"]);
140
141 $ctrl->setParameter($this->parent_obj, "usr_id", $a_set["id"]);
142
143 $items = array();
144 $b = $ui->factory()->button();
145 if (!$mskills->getPublished() || (!ilContainer::_lookupContainerSetting($this->container_skills->getId(), "cont_skill_publish", 0))) {
146 $items[] = $b->shy($lng->txt("cont_assign_competence"), $ctrl->getLinkTarget($this->parent_obj, "assignCompetences"));
147 }
148 if (!$mskills->getPublished()) {
149 $items[] = $b->shy($lng->txt("cont_publish_assignment"), $ctrl->getLinkTarget($this->parent_obj, "publishAssignments"));
150 }
151 $items[] = $b->shy($lng->txt("cont_deassign_competence"), $ctrl->getLinkTarget($this->parent_obj, "deassignCompetencesConfirm"));
152 $dd = $ui->factory()->dropdown()->standard($items);
153
154 $tpl->setVariable("ACTIONS", $ui->renderer()->render($dd));
155 }
156}
An exception for terminatinating execution or to throw for unit testing.
static lookupLevelTitle(int $a_id)
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: goto.php:24
if($format !==null) $name
Definition: metadata.php:230
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
ui()
Definition: ui.php:5