ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilSolutionExplorer.php
Go to the documentation of this file.
1 <?php
2 
19 /*
20 * Solution Explorer for question pools
21 *
22 * @author Helmut Schottmüller <helmut.schottmueller@mac.com>
23 * @version $Id$
24 *
25 * @ingroup components\ILIASTestQuestionPool
26 */
28 {
34  public $root_id;
35  public $ctrl;
36 
38  public $ref_id;
39  public $target_class;
40 
46  public function __construct($a_target, $a_target_class)
47  {
48  global $DIC;
49  $tree = $DIC['tree'];
50  $ilCtrl = $DIC['ilCtrl'];
51 
52  $this->ctrl = $ilCtrl;
53  $this->target_class = $a_target_class;
54  parent::__construct($a_target);
55  $this->tree = $tree;
56  $this->root_id = $this->tree->readRootId();
57  $this->order_column = "title";
58 
59  $this->setSessionExpandVariable("expand_sol");
60 
61  // add here all container objects
62  $this->addFilter("root");
63  $this->addFilter("cat");
64  $this->addFilter("grp");
65  $this->addFilter("fold");
66  $this->addFilter("crs");
67 
69  $this->setFiltered(true);
70  }
71 
75  public function expandPathByRefId($ref_id): void
76  {
80  global $DIC;
81  $tree = $DIC['tree'];
82 
83  if (ilSession::get($this->expand_variable) == null) {
84  ilSession::set($this->expand_variable, []);
85  }
86 
88  foreach ((array) $path as $node_id) {
89  if (!in_array($node_id, ilSession::get($this->expand_variable))) {
90  $expand = ilSession::get($this->expand_variable);
91  $expand[] = $node_id;
92  ilSession::set($this->expand_variable, $expand);
93  }
94  }
95 
96  $this->expanded = ilSession::get($this->expand_variable);
97  }
98 
99  public function setSelectableType($a_type): void
100  {
101  $this->selectable_type = $a_type;
102  }
103  public function setRefId($a_ref_id): void
104  {
105  $this->ref_id = $a_ref_id;
106  }
107 
108 
109  public function buildLinkTarget($a_node_id, string $a_type): string
110  {
111  if ($a_type == $this->selectable_type) {
112  $this->ctrl->setParameterByClass($this->target_class, 'source_id', $a_node_id);
113  return $this->ctrl->getLinkTargetByClass($this->target_class, 'linkChilds');
114  } else {
115  $this->ctrl->setParameterByClass($this->target_class, "ref_id", $this->ref_id);
116  return $this->ctrl->getLinkTargetByClass($this->target_class, 'addSolutionHint');
117  }
118  }
119 
120  public function buildFrameTarget(string $a_type, $a_child = 0, $a_obj_id = 0): string
121  {
122  return '';
123  }
124 
125  public function isClickable(string $type, int $ref_id = 0): bool
126  {
127  return $type == $this->selectable_type && $ref_id !== $this->ref_id;
128  }
129 
130  public function showChilds($a_parent_id): bool
131  {
132  global $DIC;
133  $rbacsystem = $DIC['rbacsystem'];
134 
135  if ($a_parent_id == 0) {
136  return true;
137  }
138 
139  if ($rbacsystem->checkAccess("read", $a_parent_id)) {
140  return true;
141  } else {
142  return false;
143  }
144  }
145 } // END class ilSolutionExplorer
setSessionExpandVariable(string $a_var_name="expand")
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFiltered(bool $a_bool)
__construct($a_target, $a_target_class)
Constructor public.
buildLinkTarget($a_node_id, string $a_type)
const IL_FM_POSITIVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilRbacSystem $rbacsystem
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
buildFrameTarget(string $a_type, $a_child=0, $a_obj_id=0)
global $DIC
Definition: shib_login.php:22
class for explorer view in admin frame
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
__construct(Container $dic, ilPlugin $plugin)
addFilter(string $a_item)
isClickable(string $type, int $ref_id=0)
static set(string $a_var, $a_val)
Set a value.
setFilterMode(int $a_mode=IL_FM_NEGATIVE)