ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilConditionSelector.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php";
5
14{
15 protected $highlighted_parent = null;
16 protected $clickable_types = array();
17 protected $ref_id = null;
18
28 public function __construct(
29 $a_parent_obj,
30 $a_parent_cmd,
31 $a_selection_gui = null,
32 $a_selection_cmd = "add",
33 $a_selection_par = "source_id"
34 ) {
36 $a_parent_obj,
37 $a_parent_cmd,
38 $a_selection_gui,
39 $a_selection_cmd,
40 $a_selection_par
41 );
42
43 $this->setAjax(true);
44 }
45
52 public function isNodeVisible($a_node)
53 {
54 global $DIC;
55
56 $ilAccess = $DIC['ilAccess'];
57 $tree = $DIC['tree'];
58
59 if (!$ilAccess->checkAccess('read', '', $a_node["child"])) {
60 return false;
61 }
62 //remove childs of target object
63 if ($tree->getParentId($a_node["child"]) == $this->getRefId()) {
64 return false;
65 }
66
67 return true;
68 }
69
76 public function isNodeClickable($a_node)
77 {
78 if (!parent::isNodeClickable($a_node)) {
79 return false;
80 }
81
82 if ($a_node["child"] == $this->getRefId()) {
83 return false;
84 }
85
86 return true;
87 }
88
94 public function setRefId($a_ref_id)
95 {
96 global $DIC;
97
98 $tree = $DIC['tree'];
99
100 $this->ref_id = $a_ref_id;
101
102 //can target object be highlighted?
103 $target_type = ilObject::_lookupType($a_ref_id, true);
104
105 if (!in_array($target_type, $this->getTypeWhiteList())) {
106 $this->highlighted_parent = $tree->getParentId($a_ref_id);
107 }
108 }
109
115 public function getRefId()
116 {
117 return $this->ref_id;
118 }
119
126 public function isNodeHighlighted($a_node)
127 {
128 //highlight parent if target object cant be highlighted
129 if ($this->highlighted_parent == $a_node["child"]) {
130 return true;
131 }
132
133 return parent::isNodeHighlighted($a_node);
134 }
135}
An exception for terminatinating execution or to throw for unit testing.
isNodeHighlighted($a_node)
Is node highlighted?
setRefId($a_ref_id)
set ref id of target object
isNodeVisible($a_node)
Is node visible.
__construct( $a_parent_obj, $a_parent_cmd, $a_selection_gui=null, $a_selection_cmd="add", $a_selection_par="source_id")
Construct.
getRefId()
get ref id of target object
isNodeClickable($a_node)
Is node clickable?
static _lookupType($a_id, $a_reference=false)
lookup object type
Explorer for selecting repository items.
getTypeWhiteList()
Get type white list.
$target_type
Definition: goto.php:48
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46