ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSurveySkillExplorer.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/Skill/classes/class.ilSkillTreeNode.php");
6 
15 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
16 
18 {
22  protected $user;
23 
27  protected $ctrl;
28 
34  public $root_id;
35  public $slm_obj;
36  public $output;
37 
44  public function __construct($a_target, $a_templates = false)
45  {
46  global $DIC;
47 
48  $this->user = $DIC->user();
49  $this->ctrl = $DIC->ctrl();
50  $this->lng = $DIC->language();
51  $this->templates = $a_templates;
52 
53  parent::__construct($a_target);
54 
56  $this->addFilter("skrt");
57  $this->addFilter("skll");
58  $this->addFilter("scat");
59  // $this->addFilter("sktr");
60  $this->setTitleLength(999);
61 
62  include_once("./Services/Skill/classes/class.ilSkillTree.php");
63  $this->tree = new ilSkillTree();
64  $this->root_id = $this->tree->readRootId();
65 
66  $this->setSessionExpandVariable("skpexpand");
67  $this->checkPermissions(false);
68  $this->setPostSort(false);
69 
70  $this->setOrderColumn("order_nr");
71  // $this->textwidth = 200;
72 
73  $this->force_open_path = array();
74 
75  $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
76  foreach ($this->all_nodes as $n) {
77  $this->node[$n["child"]] = $n;
78  $this->child_nodes[$n["parent"]][] = $n;
79  $this->parent[$n["child"]] = $n["parent"];
80  //echo "-$k-"; var_dump($n);
81  }
82 
83  // $this->buildSelectableTree($this->root_id);
84  }
85 
92  /*
93  function buildSelectableTree($a_node_id)
94  {
95  if (ilSkillTreeNode::_lookupSelfEvaluation($a_node_id))
96  {
97  $this->selectable[$a_node_id] = true;
98  $this->selectable[$this->parent[$a_node_id]] = true;
99  }
100  foreach ($this->getOriginalChildsOfNode($a_node_id) as $n)
101  {
102  $this->buildSelectableTree($n["child"]);
103  }
104  if ($this->selectable[$a_node_id] &&
105  !ilSkillTreeNode::_lookupDraft($a_node_id))
106  {
107  $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
108  $this->node[$a_node_id];
109  }
110  }*/
111 
112 
116  public function setForceOpenPath($a_path)
117  {
118  $this->force_open_path = $a_path;
119  }
120 
121 
129  public function isClickable($a_type, $a_obj_id = 0)
130  {
132  if ($a_type == "skll") {
133  return true;
134  }
135  return false;
136  }
137 
141  public function buildLinkTarget($a_node_id, $a_type)
142  {
144 
145  $ilCtrl->setParameterByClass("ilsurveyskillgui", "obj_id", $a_node_id);
146  $ret = $ilCtrl->getLinkTargetByClass("ilsurveyskillgui", "selectSkillForQuestion");
147  $ilCtrl->setParameterByClass("ilsurveyskillgui", "obj_id", $_GET["obj_id"]);
148 
149  return $ret;
150  }
151 
155  public function buildTitle($a_title, $a_id, $a_type)
156  {
157  $lng = $this->lng;
158 
159  if ($a_type == "sktr") {
160  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
162  // $a_title.= " (".ilSkillTreeNode::_lookupTitle($tid).")";
163  }
164 
165  /* if (ilSkillTreeNode::_lookupSelfEvaluation($a_id))
166  {
167  $a_title.= " [".$lng->txt("add")."]";
168  }*/
169 
170  return $a_title;
171  }
172 
176  public function forceExpanded($a_obj_id)
177  {
178  if (in_array($a_obj_id, $this->force_open_path)) {
179  return true;
180  }
181  return false;
182  }
183 
187  public function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
188  {
189  return "";
190  }
191 
198  /* function getMaximumTreeDepth()
199  {
200  $this->tree->getMaximumDepth();
201  }*/
202 
209  /*
210  function getChildsOfNode($a_parent_id)
211  {
212  if (is_array($this->selectable_child_nodes[$a_parent_id]))
213  {
214  $childs = $this->selectable_child_nodes[$a_parent_id];
215  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
216  return $childs;
217  }
218  return array();
219  }*/
220 
227  /* function getOriginalChildsOfNode($a_parent_id)
228  {
229  if (is_array($this->child_nodes[$a_parent_id]))
230  {
231  return $this->child_nodes[$a_parent_id];
232  }
233  return array();
234  }*/
235 
239  public function getImage($a_name, $a_type = "", $a_obj_id = "")
240  {
241  if (in_array($a_type, array("sktr"))) {
242  return ilUtil::getImagePath("icon_skll_s.gif");
243  }
244  return ilUtil::getImagePath($a_name);
245  }
246 }
buildTitle($a_title, $a_id, $a_type)
standard implementation for title, may be overwritten by derived classes
setPostSort($a_sort)
process post sorting
forceExpanded($a_obj_id)
force expansion of node
buildLinkTarget($a_node_id, $a_type)
build link target
setFilterMode($a_mode=IL_FM_NEGATIVE)
set filter mode
global $DIC
Definition: saml.php:7
Skill tree.
$_GET["client_id"]
setTitleLength($a_length)
Set max title length.
const IL_FM_POSITIVE
checkPermissions($a_check)
check permissions via rbac
isClickable($a_type, $a_obj_id=0)
check if links for certain object type are activated
__construct($a_target, $a_templates=false)
Constructor public.
user()
Definition: user.php:4
setOrderColumn($a_column)
set the order column public
global $ilCtrl
Definition: ilias.php:18
$a_type
Definition: workflow.php:92
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
Get frame target.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$ilUser
Definition: imgupload.php:18
static _lookupTemplateId($a_obj_id)
Lookup template ID.
$n
Definition: RandomTest.php:85
Explorer for skill management.
Class ilExplorer class for explorer view in admin frame.
getImage($a_name, $a_type="", $a_obj_id="")
Get maximum tree depth.
setForceOpenPath($a_path)
Build selectable tree.
$ret
Definition: parser.php:6
setSessionExpandVariable($a_var_name="expand")
set name of expand session variable
addFilter($a_item)
adds item to the filter public