ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
5 include_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  {
83  $lng = $this->lng;
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 
94  include_once "Services/Object/classes/class.ilObjectLP.php";
95  if (ilObjectLP::isSupportedObjectType($obj_type)) {
96  if ($a_set["trigger"]) {
97  $this->tpl->touchBlock("trig_checked");
98  }
99  $this->tpl->setCurrentBlock("trigger_checkbox");
100  $this->tpl->setVariable("TR_ID", $ref_id);
101  $this->tpl->parseCurrentBlock();
102  }
103 
104  $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($obj_id));
105  $this->tpl->setVariable("IMG", ilUtil::img(ilObject::_getIcon($obj_id, "tiny")));
106  $this->tpl->setVariable("ID", $ref_id);
107 
108  $path = $tree->getPathFull($ref_id);
109  $path_items = array();
110  foreach ($path as $p) {
111  if ($p["type"] != "root" && $p["child"] != $ref_id) {
112  $path_items[] = $p["title"];
113  }
114  }
115  $this->tpl->setVariable("PATH", implode($path_items, " > "));
116  }
117 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
static isSupportedObjectType($a_type)
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct( $a_parent_obj, $a_parent_cmd, $a_skill_id, $a_tref_id, $a_level_id, $a_write_permission=false)
Constructor.
Class ilTable2GUI.
static _lookupObjId($a_id)
Manages resources for skills.
addMultiCommand($a_cmd, $a_text)
Add Command button.
TableGUI class for skill level resources.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.