ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilWorkspaceFolderUserSettings.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $tree;
16
20 protected $user_id;
21
25 protected $repo;
26
31 {
32 $this->repo = $repo;
33 $this->user_id = $user_id;
34 $this->tree = ($tree != null)
35 ? $tree
37 }
38
44 public function getSortation(int $wfld_id) : int
45 {
46 $sort = $this->repo->getSortation($wfld_id);
47 if ($sort > 0) {
48 return $sort;
49 }
50 if (ilObject::_lookupType($wfld_id) == "wfld") {
52 }
54 }
55
61 public function updateSortation(int $wfld_id, int $sortation)
62 {
63 $this->repo->updateSortation($wfld_id, $sortation);
64 }
65
72 public function getEffectiveSortation(int $wfld_wsp_id)
73 {
75
76 // get path
77 $path = $tree->getPathId($wfld_wsp_id);
78 // get object ids of path
79 $obj_ids = array_map(function ($wsp_id) use ($tree) {
80 return $tree->lookupObjectId($wsp_id);
81 }, $path);
82
83 // get sortations for object ids
84 $sortations = $this->repo->getSortationMultiple($obj_ids);
85
86 // search bottom to top first one with sortation > 0
87 foreach (array_reverse($obj_ids) as $id) {
88 if ($sortations[$id] > 0) {
89 return $sortations[$id];
90 }
91 }
93 }
94}
An exception for terminatinating execution or to throw for unit testing.
static _lookupType($a_id, $a_reference=false)
lookup object type
Stores user settings per workspace folder Table: wfld_user_setting (rw)
User settings for workspace folders.
updateSortation(int $wfld_id, int $sortation)
Update sortation for workspace folder.
__construct(int $user_id, ilWorkspaceFolderUserSettingsRepository $repo, ilWorkspaceTree $tree=null)
Constructor.
getEffectiveSortation(int $wfld_wsp_id)
Get effective sortation for a workspace folder (next upper context that has sortation > 0)
getSortation(int $wfld_id)
Get Sortation of workspace folder.
Tree handler for personal workspace.