diff options
| author | Thomas Hackl <hackl@data-quest.de> | 2023-07-14 19:42:50 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-07-14 19:42:50 +0000 |
| commit | 93562d9757edd37202117145c85296a51b2cdc90 (patch) | |
| tree | db19e74ecbb3b53404e0455cf1cfca8c153eab62 /lib/models/StudipStudyArea.class.php | |
| parent | c82b6b0aba4527d505e985b1f484b2a598dc5b43 (diff) | |
Resolve "SQL-Fehler, wenn "Meine Veranstaltungen" nach Studienbereich gruppiert ist"
Closes #2854
Merge request studip/studip!1933
Diffstat (limited to 'lib/models/StudipStudyArea.class.php')
| -rw-r--r-- | lib/models/StudipStudyArea.class.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/models/StudipStudyArea.class.php b/lib/models/StudipStudyArea.class.php index 49f008a..2975fb4 100644 --- a/lib/models/StudipStudyArea.class.php +++ b/lib/models/StudipStudyArea.class.php @@ -610,4 +610,26 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode return $ids; } + /** + * Constructs an index from the level hierarchy, This index is a number, + * containing the "depth" level and the priority on this level. For example, + * a node on level 2 with priority 3 will get an index of 23. + * + * @return int + */ + public function getIndex() + { + $level = 1; + $index = (string) $level . (string) $this->priority; + $current = $this; + + while ($current->getParent()) { + $current = $current->getParent(); + $index .= $level . $current->priority; + $level++; + } + + return $index; + } + } |
