ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Skill\Table\AssignMaterialsTable Class Reference
+ Collaboration diagram for ILIAS\Skill\Table\AssignMaterialsTable:

Public Member Functions

 __construct (int $top_skill_id, int $tref_id, int $basic_skill_id)
 
 getComponent ()
 

Protected Member Functions

 getColumns ()
 
 getActions ()
 
 getDataRetrieval ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
ilWorkspaceTree $ws_tree
 
ilWorkspaceAccessHandler $ws_access
 
UI Factory $ui_fac
 
ServerRequestInterface $request
 
Data Factory $df
 
ilSkillTreeRepository $tree_repo
 
Node SkillTreeNodeManager $node_manager
 
Personal AssignedMaterialManager $assigned_material_manager
 
int $top_skill_id = 0
 
int $tref_id = 0
 
int $basic_skill_id = 0
 

Detailed Description

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 32 of file class.AssignMaterialsTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Table\AssignMaterialsTable::__construct ( int  $top_skill_id,
int  $tref_id,
int  $basic_skill_id 
)

Definition at line 49 of file class.AssignMaterialsTable.php.

50 {
51 global $DIC;
52
53 $this->ctrl = $DIC->ctrl();
54 $this->lng = $DIC->language();
55 $this->user = $DIC->user();
56 $this->ui_fac = $DIC->ui()->factory();
57 $this->request = $DIC->http()->request();
58 $this->df = new Data\Factory();
59 $this->ws_tree = new \ilWorkspaceTree($this->user->getId());
60 if (!$this->ws_tree->readRootId()) {
61 $this->ws_tree->createTreeForUser($this->user->getId());
62 }
63 $this->ws_access = new \ilWorkspaceAccessHandler();
64
65 $this->top_skill_id = $top_skill_id;
66 $this->tref_id = $tref_id;
67 $this->basic_skill_id = $basic_skill_id;
68
69 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
70 $tree_id = $this->tree_repo->getTreeIdForNodeId($this->basic_skill_id);
71 $this->node_manager = $DIC->skills()->internal()->manager()->getTreeNodeManager($tree_id);
72 $this->assigned_material_manager = $DIC->skills()->internal()->manager()->getAssignedMaterialManager();
73 }
global $DIC
Definition: shib_login.php:26

References ILIAS\Skill\Table\AssignMaterialsTable\$basic_skill_id, $DIC, ILIAS\Skill\Table\AssignMaterialsTable\$top_skill_id, ILIAS\Skill\Table\AssignMaterialsTable\$tref_id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by ILIAS\Skill\Table\AssignMaterialsTable\getDataRetrieval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ getActions()

ILIAS\Skill\Table\AssignMaterialsTable::getActions ( )
protected

Definition at line 110 of file class.AssignMaterialsTable.php.

110 : array
111 {
112 $query_params_namespace = ["skl_assign_materials_table"];
113
114 $uri_assign = $this->df->uri(
115 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
116 "ilpersonalskillsgui",
117 "assignMaterial"
118 )
119 );
120 $url_builder_assign = new UI\URLBuilder($uri_assign);
121 list($url_builder_assign, $action_parameter_token_assign, $row_id_token_assign) =
122 $url_builder_assign->acquireParameters(
123 $query_params_namespace,
124 "action",
125 "level_ids"
126 );
127
128 $actions = [
129 "assign" => $this->ui_fac->table()->action()->single(
130 $this->lng->txt("skmg_assign_materials"),
131 $url_builder_assign->withParameter($action_parameter_token_assign, "assignMaterials"),
132 $row_id_token_assign
133 )
134 ];
135
136 foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
137 $this->user->getId(),
138 $this->basic_skill_id,
139 $this->tref_id,
140 ) as $material) {
141 $obj_id = $this->ws_tree->lookupObjectId($material->getWorkspaceId());
142
143 $uri_remove = $this->df->uri(
144 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
145 "ilpersonalskillsgui",
146 "removeMaterial"
147 )
148 );
149 $url_builder_remove = new UI\URLBuilder($uri_remove);
150 list($url_builder_remove, $action_parameter_token_remove, $row_id_token_remove, $wsp_token_remove) =
151 $url_builder_remove->acquireParameters(
152 $query_params_namespace,
153 "action",
154 "level_ids",
155 "wsp_id"
156 );
157 $url_builder_remove = $url_builder_remove->withParameter($wsp_token_remove, (string) $material->getWorkspaceId());
158
159 $actions["remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()] =
160 $this->ui_fac->table()->action()->single(
161 $this->lng->txt("skmg_remove") . " '" . \ilObject::_lookupTitle($obj_id) . "'",
162 $url_builder_remove->withParameter($action_parameter_token_remove, "removeMaterial"),
163 $row_id_token_remove
164 );
165 }
166
167 return $actions;
168 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\AssignMaterialsTable\getComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\Skill\Table\AssignMaterialsTable::getColumns ( )
protected

Definition at line 96 of file class.AssignMaterialsTable.php.

96 : array
97 {
98 $columns = [
99 "title" => $this->ui_fac->table()->column()->text($this->lng->txt("skmg_skill_level"))
100 ->withIsSortable(false),
101 "description" => $this->ui_fac->table()->column()->text($this->lng->txt("description"))
102 ->withIsSortable(false),
103 "resources" => $this->ui_fac->table()->column()->listing($this->lng->txt("skmg_materials"))
104 ->withIsSortable(false)
105 ];
106
107 return $columns;
108 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\AssignMaterialsTable\getComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ILIAS\Skill\Table\AssignMaterialsTable::getComponent ( )

Definition at line 75 of file class.AssignMaterialsTable.php.

75 : UI\Component\Table\Data
76 {
77 $columns = $this->getColumns();
78 $actions = $this->getActions();
79 $data_retrieval = $this->getDataRetrieval();
80
81 $title = $this->node_manager->getWrittenPath($this->basic_skill_id);
82 $table = $this->ui_fac->table()
83 ->data($data_retrieval, $title, $columns)
84 ->withId(
85 str_replace('\\', '', self::class) . "_" .
86 $this->top_skill_id . "_" .
87 $this->tref_id . "_" .
88 $this->basic_skill_id
89 )
90 ->withActions($actions)
91 ->withRequest($this->request);
92
93 return $table;
94 }

References ILIAS\Skill\Table\AssignMaterialsTable\getActions(), ILIAS\Skill\Table\AssignMaterialsTable\getColumns(), and ILIAS\Skill\Table\AssignMaterialsTable\getDataRetrieval().

+ Here is the call graph for this function:

◆ getDataRetrieval()

ILIAS\Skill\Table\AssignMaterialsTable::getDataRetrieval ( )
protected

Definition at line 170 of file class.AssignMaterialsTable.php.

170 : UI\Component\Table\DataRetrieval
171 {
172 $data_retrieval = new class (
180 ) implements UI\Component\Table\DataRetrieval {
181 use TableRecords;
182
183 public function __construct(
184 protected int $basic_skill_id,
185 protected int $tref_id,
186 protected \ilObjUser $user,
187 protected \ilWorkspaceTree $ws_tree,
188 protected Personal\AssignedMaterialManager $assigned_material_manager,
189 protected UI\Factory $ui_fac,
191 ) {
192 }
193
194 public function getRows(
195 UI\Component\Table\DataRowBuilder $row_builder,
196 array $visible_column_ids,
197 Data\Range $range,
198 Data\Order $order,
199 mixed $additional_viewcontrol_data,
200 mixed $filter_data,
201 mixed $additional_parameters
202 ): \Generator {
203 $records = $this->getRecords($range);
204 foreach ($records as $idx => $record) {
205 $row_id = $record["id"];
206 $res_ids = $record["res_ids"];
207
208 $data_row = $row_builder->buildDataRow((string) $row_id, $record);
209 foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
210 $this->user->getId(),
211 $this->basic_skill_id,
212 $this->tref_id,
213 ) as $material) {
214 if (!in_array($material->getWorkspaceId(), $res_ids) || $row_id != $material->getLevelId()) {
215 $data_row = $data_row->withDisabledAction(
216 "remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()
217 );
218 }
219 }
220
221 yield $data_row;
222 }
223 }
224
225 public function getTotalRowCount(
226 mixed $additional_viewcontrol_data,
227 mixed $filter_data,
228 mixed $additional_parameters
229 ): ?int {
230 return count($this->getRecords());
231 }
232
233 protected function getRecords(?Data\Range $range = null): array
234 {
235 $skill = \ilSkillTreeNodeFactory::getInstance($this->basic_skill_id);
236 $records = [];
237 $i = 0;
238 foreach ($skill->getLevelData() as $level) {
239 $records[$i]["id"] = $level["id"];
240 $records[$i]["title"] = $level["title"];
241 $records[$i]["description"] = $level["description"];
242
243 $materials = $this->assigned_material_manager->getAssignedMaterials(
244 $this->user->getId(),
245 $this->tref_id,
246 (int) $level["id"]
247 );
248 $wsp_ids = [];
249 $obj_links = [];
250 foreach ($materials as $m) {
251 $wsp_ids[] = $m->getWorkspaceId();
252 $obj_id = $this->ws_tree->lookupObjectId($m->getWorkspaceId());
253 $obj_links[] = $this->ui_fac->link()->standard(
254 \ilObject::_lookupTitle($obj_id),
255 $this->ws_access->getGotoLink($m->getWorkspaceId(), $obj_id)
256 );
257 }
258 $records[$i]["res_ids"] = $wsp_ids;
259 $records[$i]["resources"] = $this->ui_fac->listing()->unordered($obj_links);
260
261 $i++;
262 }
263
264 if ($range) {
265 $records = $this->limitRecords($records, $range);
266 }
267
268 return $records;
269 }
270 };
271
272 return $data_retrieval;
273 }
__construct(int $top_skill_id, int $tref_id, int $basic_skill_id)
Personal AssignedMaterialManager $assigned_material_manager
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Skill\Table\AssignMaterialsTable\$assigned_material_manager, ILIAS\Skill\Table\AssignMaterialsTable\$basic_skill_id, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Skill\Table\AssignMaterialsTable\$tref_id, ILIAS\Skill\Table\AssignMaterialsTable\$ui_fac, ILIAS\Skill\Table\AssignMaterialsTable\$user, ILIAS\Skill\Table\AssignMaterialsTable\$ws_access, ILIAS\Skill\Table\AssignMaterialsTable\$ws_tree, ILIAS\Skill\Table\AssignMaterialsTable\__construct(), ilObject\_lookupTitle(), and ilSkillTreeNodeFactory\getInstance().

Referenced by ILIAS\Skill\Table\AssignMaterialsTable\getComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_material_manager

Personal AssignedMaterialManager ILIAS\Skill\Table\AssignMaterialsTable::$assigned_material_manager
protected

◆ $basic_skill_id

int ILIAS\Skill\Table\AssignMaterialsTable::$basic_skill_id = 0
protected

◆ $ctrl

ilCtrl ILIAS\Skill\Table\AssignMaterialsTable::$ctrl
protected

Definition at line 34 of file class.AssignMaterialsTable.php.

◆ $df

Data Factory ILIAS\Skill\Table\AssignMaterialsTable::$df
protected

Definition at line 41 of file class.AssignMaterialsTable.php.

◆ $lng

ilLanguage ILIAS\Skill\Table\AssignMaterialsTable::$lng
protected

Definition at line 35 of file class.AssignMaterialsTable.php.

◆ $node_manager

Node SkillTreeNodeManager ILIAS\Skill\Table\AssignMaterialsTable::$node_manager
protected

Definition at line 43 of file class.AssignMaterialsTable.php.

◆ $request

ServerRequestInterface ILIAS\Skill\Table\AssignMaterialsTable::$request
protected

Definition at line 40 of file class.AssignMaterialsTable.php.

◆ $top_skill_id

int ILIAS\Skill\Table\AssignMaterialsTable::$top_skill_id = 0
protected

◆ $tree_repo

ilSkillTreeRepository ILIAS\Skill\Table\AssignMaterialsTable::$tree_repo
protected

Definition at line 42 of file class.AssignMaterialsTable.php.

◆ $tref_id

int ILIAS\Skill\Table\AssignMaterialsTable::$tref_id = 0
protected

◆ $ui_fac

UI Factory ILIAS\Skill\Table\AssignMaterialsTable::$ui_fac
protected

◆ $user

ilObjUser ILIAS\Skill\Table\AssignMaterialsTable::$user
protected

◆ $ws_access

ilWorkspaceAccessHandler ILIAS\Skill\Table\AssignMaterialsTable::$ws_access
protected

◆ $ws_tree

ilWorkspaceTree ILIAS\Skill\Table\AssignMaterialsTable::$ws_tree
protected

The documentation for this class was generated from the following file: