33 $this->
lng = ($lng != null)
37 $this->
lng->loadLanguageModule(
"wfld");
45 $sort_options = ($wsp_type ==
"wfld")
46 ? [self::SORT_DERIVED => $this->
lng->txt(
"wfld_derive")]
48 if (in_array($wsp_type, [
"wfld",
"wsrt"])) {
49 $sort_options[self::SORT_ALPHABETICAL_ASC] = $this->
getLabel(self::SORT_ALPHABETICAL_ASC);
50 $sort_options[self::SORT_ALPHABETICAL_DESC] = $this->
getLabel(self::SORT_ALPHABETICAL_DESC);
51 $sort_options[self::SORT_CREATION_ASC] = $this->
getLabel(self::SORT_CREATION_ASC);
52 $sort_options[self::SORT_CREATION_DESC] = $this->
getLabel(self::SORT_CREATION_DESC);
55 if (isset($sort_options[self::SORT_DERIVED])) {
56 $sort_options[self::SORT_DERIVED] .=
" (" . $this->
getLabel($parent_effective) .
")";
59 if (isset($sort_options[$selected])) {
60 $sort_options[$selected] =
"<strong>" . $sort_options[$selected] .
"</strong>";
65 protected function getLabel(
int $option): string
68 case self::SORT_DERIVED:
return $this->
lng->txt(
"wfld_derive");
69 case self::SORT_ALPHABETICAL_ASC:
return $this->
lng->txt(
"wfld_alphabetically_asc");
70 case self::SORT_ALPHABETICAL_DESC:
return $this->
lng->txt(
"wfld_alphabetically_desc");
71 case self::SORT_CREATION_ASC:
return $this->
lng->txt(
"wfld_creation_asc");
72 case self::SORT_CREATION_DESC:
return $this->
lng->txt(
"wfld_creation_desc");
77 public function sortNodes(array $nodes,
int $sorting): array
80 case self::SORT_ALPHABETICAL_ASC:
83 case self::SORT_ALPHABETICAL_DESC:
86 case self::SORT_CREATION_ASC:
89 case self::SORT_CREATION_DESC:
getOptionsByType(string $wsp_type, int $selected, int $parent_effective)
sortNodes(array $nodes, int $sorting)
const SORT_ALPHABETICAL_DESC
const SORT_ALPHABETICAL_ASC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilLanguage $lng=null)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)