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 7/** 8 * TableGUI class for skill profile levels 9 * 10 * @author Alex Killing <alex.killing@gmx.de> 11 * @version $Id$ 12 * 13 * @ingroup Services/Skill 14 */ 15class ilSkillProfileLevelsTableGUI extends ilTable2GUI 16{ 17 /** 18 * @var ilCtrl 19 */ 20 protected $ctrl; 21 22 /** 23 * @var ilAccessHandler 24 */ 25 protected $access; 26 27 /** 28 * Constructor 29 */ 30 public function __construct($a_parent_obj, $a_parent_cmd, $a_profile, $a_write_permission = false) 31 { 32 global $DIC; 33 34 $this->ctrl = $DIC->ctrl(); 35 $this->lng = $DIC->language(); 36 $this->access = $DIC->access(); 37 $ilCtrl = $DIC->ctrl(); 38 $lng = $DIC->language(); 39 $ilAccess = $DIC->access(); 40 $lng = $DIC->language(); 41 42 include_once("./Services/Skill/classes/class.ilBasicSkill.php"); 43 include_once("./Services/Skill/classes/class.ilSkillTree.php"); 44 $this->tree = new ilSkillTree(); 45 46 $this->profile = $a_profile; 47 parent::__construct($a_parent_obj, $a_parent_cmd); 48 49 $this->setData($this->profile->getSkillLevels()); 50 $this->setTitle($lng->txt("skmg_skill_levels")); 51 52 $this->addColumn("", "", "1", true); 53 $this->addColumn($this->lng->txt("skmg_skill")); 54 $this->addColumn($this->lng->txt("skmg_level")); 55 56 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); 57 $this->setRowTemplate("tpl.skill_profile_level_row.html", "Services/Skill"); 58 59 if ($a_write_permission) { 60 $this->addMultiCommand("confirmLevelAssignmentRemoval", $lng->txt("skmg_remove_levels")); 61 } 62 //$this->addCommandButton("", $lng->txt("")); 63 } 64 65 /** 66 * Fill table row 67 */ 68 protected function fillRow($a_set) 69 { 70 $path = $this->tree->getSkillTreePath( 71 $a_set["base_skill_id"], 72 $a_set["tref_id"] 73 ); 74 $path_items = array(); 75 foreach ($path as $p) { 76 if ($p["type"] != "skrt") { 77 $path_items[] = $p["title"]; 78 } 79 } 80 $this->tpl->setVariable( 81 "SKILL_TITLE", 82 implode($path_items, " > ") 83 ); 84 85 $this->tpl->setVariable("LEVEL_TITLE", ilBasicSkill::lookupLevelTitle($a_set["level_id"])); 86 87 $this->tpl->setVariable( 88 "ID", 89 ((int) $a_set["base_skill_id"]) . ":" . ((int) $a_set["tref_id"]) . ":" . ((int) $a_set["level_id"]) 90 ); 91 } 92} 93