ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWorkspaceFolderUserSettings.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ilTree $tree;
27 protected int $user_id;
29
30 public function __construct(
31 int $user_id,
34 ) {
35 $this->repo = $repo;
36 $this->user_id = $user_id;
37 $this->tree = ($tree != null)
38 ? $tree
40 }
41
42 public function getSortation(int $wfld_id): int
43 {
44 $sort = $this->repo->getSortation($wfld_id);
45 if ($sort > 0) {
46 return $sort;
47 }
48 if (ilObject::_lookupType($wfld_id) == "wfld") {
50 }
52 }
53
54 public function updateSortation(int $wfld_id, int $sortation)
55 {
56 $this->repo->updateSortation($wfld_id, $sortation);
57 }
58
63 public function getEffectiveSortation(int $wfld_wsp_id): int
64 {
66
67 // get path
68 $path = $tree->getPathId($wfld_wsp_id);
69 // get object ids of path
70 $obj_ids = array_map(function ($wsp_id) use ($tree) {
71 return $tree->lookupObjectId($wsp_id);
72 }, $path);
73
74 // get sortations for object ids
75 $sortations = $this->repo->getSortationMultiple($obj_ids);
76
77 // search bottom to top first one with sortation > 0
78 foreach (array_reverse($obj_ids) as $id) {
79 if ($sortations[$id] > 0) {
80 return $sortations[$id];
81 }
82 }
84 }
85}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupType(int $id, bool $reference=false)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
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...
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...
__construct(int $user_id, ilWorkspaceFolderUserSettingsRepository $repo, ?ilWorkspaceTree $tree=null)
ilWorkspaceFolderUserSettingsRepository $repo
getEffectiveSortation(int $wfld_wsp_id)
Get effective sortation for a workspace folder (next upper context that has sortation > 0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:30