ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillLevelResourcesTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $ctrl;
16
20 protected $access;
21
25 protected $tree;
26
30 public function __construct(
31 $a_parent_obj,
32 $a_parent_cmd,
33 $a_skill_id,
34 $a_tref_id,
35 $a_level_id,
36 $a_write_permission = false
37 ) {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 $this->access = $DIC->access();
43 $this->tree = $DIC->repositoryTree();
44
45 $ilCtrl = $DIC->ctrl();
46 $lng = $DIC->language();
47
48 $this->level_id = $a_level_id;
49
50 $this->resources = new ilSkillResources($a_skill_id, $a_tref_id);
51
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53 $this->setData($this->resources->getResourcesOfLevel($a_level_id));
54 $this->setTitle($lng->txt("resources"));
55
56 $this->addColumn("", "", "1px", true);
57 $this->addColumn($this->lng->txt("type"), "", "1px");
58 $this->addColumn($this->lng->txt("title"), "");
59 $this->addColumn($this->lng->txt("path"));
60 $this->addColumn($this->lng->txt("skmg_suggested"));
61 $this->addColumn($this->lng->txt("skmg_lp_triggers_level"));
62
63 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
64 $this->setRowTemplate("tpl.level_resources_row.html", "Services/Skill");
65
66 if ($a_write_permission) {
67 $this->addMultiCommand("confirmLevelResourcesRemoval", $lng->txt("remove"));
68 $this->addCommandButton("saveResourceSettings", $lng->txt("skmg_save_settings"));
69 }
70 }
71
75 protected function fillRow($a_set)
76 {
79
80 $ref_id = $a_set["rep_ref_id"];
81 $obj_id = ilObject::_lookupObjId($ref_id);
82 $obj_type = ilObject::_lookupType($obj_id);
83
84 if ($a_set["imparting"]) {
85 $this->tpl->touchBlock("sugg_checked");
86 }
87 $this->tpl->setCurrentBlock("suggested_checkbox");
88 $this->tpl->setVariable("SG_ID", $ref_id);
89 $this->tpl->parseCurrentBlock();
90
91 if (ilObjectLP::isSupportedObjectType($obj_type)) {
92 if ($a_set["trigger"]) {
93 $this->tpl->touchBlock("trig_checked");
94 }
95 $this->tpl->setCurrentBlock("trigger_checkbox");
96 $this->tpl->setVariable("TR_ID", $ref_id);
97 $this->tpl->parseCurrentBlock();
98 }
99
100 $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($obj_id));
101 $this->tpl->setVariable("IMG", ilUtil::img(ilObject::_getIcon($obj_id, "tiny")));
102 $this->tpl->setVariable("ID", $ref_id);
103
104 $path = $tree->getPathFull($ref_id);
105 $path_items = array();
106 foreach ($path as $p) {
107 if ($p["type"] != "root" && $p["child"] != $ref_id) {
108 $path_items[] = $p["title"];
109 }
110 }
111 $this->tpl->setVariable("PATH", implode(" > ", $path_items));
112 }
113}
An exception for terminatinating execution or to throw for unit testing.
static isSupportedObjectType($type)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
TableGUI class for skill level resources.
__construct( $a_parent_obj, $a_parent_cmd, $a_skill_id, $a_tref_id, $a_level_id, $a_write_permission=false)
Constructor.
Manages resources for skills.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc