ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSkillLevelResourcesTableGUI.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 $ctrl;
21
25 protected $access;
26
30 protected $tree;
31
35 public function __construct(
36 $a_parent_obj,
37 $a_parent_cmd,
38 $a_skill_id,
39 $a_tref_id,
40 $a_level_id,
41 $a_write_permission = false
42 ) {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->access = $DIC->access();
48 $this->tree = $DIC->repositoryTree();
49
50 $ilCtrl = $DIC->ctrl();
51 $lng = $DIC->language();
52
53 $this->level_id = $a_level_id;
54
55 include_once("./Services/Skill/classes/class.ilSkillResources.php");
56 $this->resources = new ilSkillResources($a_skill_id, $a_tref_id);
57
58 parent::__construct($a_parent_obj, $a_parent_cmd);
59 $this->setData($this->resources->getResourcesOfLevel($a_level_id));
60 $this->setTitle($lng->txt("resources"));
61
62 $this->addColumn("", "", "1px", true);
63 $this->addColumn($this->lng->txt("type"), "", "1px");
64 $this->addColumn($this->lng->txt("title"), "");
65 $this->addColumn($this->lng->txt("path"));
66 $this->addColumn($this->lng->txt("skmg_suggested"));
67 $this->addColumn($this->lng->txt("skmg_lp_triggers_level"));
68
69 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
70 $this->setRowTemplate("tpl.level_resources_row.html", "Services/Skill");
71
72 if ($a_write_permission) {
73 $this->addMultiCommand("confirmLevelResourcesRemoval", $lng->txt("remove"));
74 $this->addCommandButton("saveResourceSettings", $lng->txt("skmg_save_settings"));
75 }
76 }
77
81 protected function fillRow($a_set)
82 {
85
86 $ref_id = $a_set["rep_ref_id"];
87 $obj_id = ilObject::_lookupObjId($ref_id);
88 $obj_type = ilObject::_lookupType($obj_id);
89
90 if ($a_set["imparting"]) {
91 $this->tpl->touchBlock("sugg_checked");
92 }
93 $this->tpl->setCurrentBlock("suggested_checkbox");
94 $this->tpl->setVariable("SG_ID", $ref_id);
95 $this->tpl->parseCurrentBlock();
96
97 include_once "Services/Object/classes/class.ilObjectLP.php";
98 if (ilObjectLP::isSupportedObjectType($obj_type)) {
99 if ($a_set["trigger"]) {
100 $this->tpl->touchBlock("trig_checked");
101 }
102 $this->tpl->setCurrentBlock("trigger_checkbox");
103 $this->tpl->setVariable("TR_ID", $ref_id);
104 $this->tpl->parseCurrentBlock();
105 }
106
107 $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($obj_id));
108 $this->tpl->setVariable("IMG", ilUtil::img(ilObject::_getIcon($obj_id, "tiny")));
109 $this->tpl->setVariable("ID", $ref_id);
110
111 $path = $tree->getPathFull($ref_id);
112 $path_items = array();
113 foreach ($path as $p) {
114 if ($p["type"] != "root" && $p["child"] != $ref_id) {
115 $path_items[] = $p["title"];
116 }
117 }
118 $this->tpl->setVariable("PATH", implode(" > ", $path_items));
119 }
120}
An exception for terminatinating execution or to throw for unit testing.
static isSupportedObjectType($a_type)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
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 $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46