ILIAS  release_8 Revision v8.24
class.ilSolutionExplorer.php
Go to the documentation of this file.
1<?php
2
19include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
20
21/*
22* Solution Explorer for question pools
23*
24* @author Helmut Schottmüller <helmut.schottmueller@mac.com>
25* @version $Id$
26*
27* @ingroup ModulesTestQuestionPool
28 */
29
31{
37 public $root_id;
38 public $ctrl;
39
41 public $ref_id;
43
49 public function __construct($a_target, $a_target_class)
50 {
51 global $DIC;
52 $tree = $DIC['tree'];
53 $ilCtrl = $DIC['ilCtrl'];
54
55 $this->ctrl = $ilCtrl;
56 $this->target_class = $a_target_class;
57 parent::__construct($a_target);
58 $this->tree = $tree;
59 $this->root_id = $this->tree->readRootId();
60 $this->order_column = "title";
61
62 $this->setSessionExpandVariable("expand_sol");
63
64 // add here all container objects
65 $this->addFilter("root");
66 $this->addFilter("cat");
67 $this->addFilter("grp");
68 $this->addFilter("fold");
69 $this->addFilter("crs");
70
72 $this->setFiltered(true);
73 }
74
78 public function expandPathByRefId($ref_id): void
79 {
83 global $DIC;
84 $tree = $DIC['tree'];
85
86 if (ilSession::get($this->expand_variable) == null) {
87 ilSession::set($this->expand_variable, array());
88 }
89
91 foreach ((array) $path as $node_id) {
92 if (!in_array($node_id, ilSession::get($this->expand_variable))) {
93 $expand = ilSession::get($this->expand_variable);
94 $expand[] = $node_id;
95 ilSession::set($this->expand_variable, $expand);
96 }
97 }
98
99 $this->expanded = ilSession::get($this->expand_variable);
100 }
101
102 public function setSelectableType($a_type): void
103 {
104 $this->selectable_type = $a_type;
105 }
106 public function setRefId($a_ref_id): void
107 {
108 $this->ref_id = $a_ref_id;
109 }
110
111
112 public function buildLinkTarget($a_node_id, string $a_type): string
113 {
114 if ($a_type == $this->selectable_type) {
115 $this->ctrl->setParameterByClass($this->target_class, 'source_id', $a_node_id);
116 return $this->ctrl->getLinkTargetByClass($this->target_class, 'linkChilds');
117 } else {
118 $this->ctrl->setParameterByClass($this->target_class, "ref_id", $this->ref_id);
119 return $this->ctrl->getLinkTargetByClass($this->target_class, 'addSolutionHint');
120 }
121 }
122
123 public function buildFrameTarget(string $a_type, $a_child = 0, $a_obj_id = 0): string
124 {
125 return '';
126 }
127
128 public function isClickable(string $type, int $ref_id = 0): bool
129 {
130 return $type == $this->selectable_type && $ref_id !== $this->ref_id;
131 }
132
133 public function showChilds($a_parent_id): bool
134 {
135 global $DIC;
136 $rbacsystem = $DIC['rbacsystem'];
137
138 if ($a_parent_id == 0) {
139 return true;
140 }
141
142 if ($rbacsystem->checkAccess("read", $a_parent_id)) {
143 return true;
144 } else {
145 return false;
146 }
147 }
148} // END class ilSolutionExplorer
const IL_FM_POSITIVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class for explorer view in admin frame
addFilter(string $a_item)
ilRbacSystem $rbacsystem
setFilterMode(int $a_mode=IL_FM_NEGATIVE)
setSessionExpandVariable(string $a_var_name="expand")
setFiltered(bool $a_bool)
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 ...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($a_target, $a_target_class)
Constructor @access public.
buildLinkTarget($a_node_id, string $a_type)
showChilds($a_parent_id)
determines wether the childs of an object should be shown or not note: this standard implementation a...
isClickable(string $type, int $ref_id=0)
buildFrameTarget(string $a_type, $a_child=0, $a_obj_id=0)
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...
global $DIC
Definition: feed.php:28
$path
Definition: ltiservices.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type