ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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;
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
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...
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26