ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ) {
35 parent::__construct(
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 $ilAccess, $tree;
55
56 if (!$ilAccess->checkAccess('read', '', $a_node["child"])) {
57 return false;
58 }
59 //remove childs of target object
60 if ($tree->getParentId($a_node["child"]) == $this->getRefId()) {
61 return false;
62 }
63
64 return true;
65 }
66
73 public function isNodeClickable($a_node)
74 {
75 if (!parent::isNodeClickable($a_node)) {
76 return false;
77 }
78
79 if ($a_node["child"] == $this->getRefId()) {
80 return false;
81 }
82
83 return true;
84 }
85
91 public function setRefId($a_ref_id)
92 {
93 global $tree;
94
95 $this->ref_id = $a_ref_id;
96
97 //can target object be highlighted?
98 $target_type = ilObject::_lookupType($a_ref_id, true);
99
100 if (!in_array($target_type, $this->getTypeWhiteList())) {
101 $this->highlighted_parent = $tree->getParentId($a_ref_id);
102 }
103 }
104
110 public function getRefId()
111 {
112 return $this->ref_id;
113 }
114
121 public function isNodeHighlighted($a_node)
122 {
123 //highlight parent if target object cant be highlighted
124 if ($this->highlighted_parent == $a_node["child"]) {
125 return true;
126 }
127
128 return parent::isNodeHighlighted($a_node);
129 }
130}
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