ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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  */
27 
29 {
35  public $root_id;
36  public $ctrl;
37 
39  public $ref_id;
40  public $target_class;
41 
47  public function __construct($a_target, $a_target_class)
48  {
49  global $DIC;
50  $tree = $DIC['tree'];
51  $ilCtrl = $DIC['ilCtrl'];
52 
53  $this->ctrl = $ilCtrl;
54  $this->target_class = $a_target_class;
55  parent::__construct($a_target);
56  $this->tree = $tree;
57  $this->root_id = $this->tree->readRootId();
58  $this->order_column = "title";
59 
60  $this->setSessionExpandVariable("expand_sol");
61 
62  // add here all container objects
63  $this->addFilter("root");
64  $this->addFilter("cat");
65  $this->addFilter("grp");
66  $this->addFilter("fold");
67  $this->addFilter("crs");
68 
70  $this->setFiltered(true);
71  }
72 
76  public function expandPathByRefId($ref_id): void
77  {
81  global $DIC;
82  $tree = $DIC['tree'];
83 
84  if (ilSession::get($this->expand_variable) == null) {
85  ilSession::set($this->expand_variable, []);
86  }
87 
89  foreach ((array) $path as $node_id) {
90  if (!in_array($node_id, ilSession::get($this->expand_variable))) {
91  $expand = ilSession::get($this->expand_variable);
92  $expand[] = $node_id;
93  ilSession::set($this->expand_variable, $expand);
94  }
95  }
96 
97  $this->expanded = ilSession::get($this->expand_variable);
98  }
99 
100  public function setSelectableType($a_type): void
101  {
102  $this->selectable_type = $a_type;
103  }
104  public function setRefId($a_ref_id): void
105  {
106  $this->ref_id = $a_ref_id;
107  }
108 
109 
110  public function buildLinkTarget($a_node_id, string $a_type): string
111  {
112  if ($a_type == $this->selectable_type) {
113  $this->ctrl->setParameterByClass($this->target_class, 'source_id', $a_node_id);
114  return $this->ctrl->getLinkTargetByClass($this->target_class, 'linkChilds');
115  } else {
116  $this->ctrl->setParameterByClass($this->target_class, "ref_id", $this->ref_id);
117  return $this->ctrl->getLinkTargetByClass($this->target_class, 'addSolutionHint');
118  }
119  }
120 
121  public function buildFrameTarget(string $a_type, $a_child = 0, $a_obj_id = 0): string
122  {
123  return '';
124  }
125 
126  public function isClickable(string $type, int $ref_id = 0): bool
127  {
128  return $type == $this->selectable_type && $ref_id !== $this->ref_id;
129  }
130 
131  public function showChilds($a_parent_id): bool
132  {
133  global $DIC;
134  $rbacsystem = $DIC['rbacsystem'];
135 
136  if ($a_parent_id == 0) {
137  return true;
138  }
139 
140  if ($rbacsystem->checkAccess("read", $a_parent_id)) {
141  return true;
142  } else {
143  return false;
144  }
145  }
146 } // 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:30
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:25
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)