ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWorkspaceFolderSorting Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilWorkspaceFolderSorting:

Public Member Functions

 __construct (?ilLanguage $lng=null)
 
 getOptionsByType (string $wsp_type, int $selected, int $parent_effective)
 
 sortNodes (array $nodes, int $sorting)
 

Data Fields

const SORT_DERIVED = 0
 
const SORT_ALPHABETICAL_ASC = 1
 
const SORT_ALPHABETICAL_DESC = 2
 
const SORT_CREATION_ASC = 3
 
const SORT_CREATION_DESC = 4
 

Protected Member Functions

 getLabel (int $option)
 

Protected Attributes

ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilWorkspaceFolderSorting.php.

Constructor & Destructor Documentation

◆ __construct()

ilWorkspaceFolderSorting::__construct ( ?ilLanguage  $lng = null)

Definition at line 29 of file class.ilWorkspaceFolderSorting.php.

30 {
31 global $DIC;
32
33 $this->lng = ($lng != null)
34 ? $lng
35 : $DIC->language();
36
37 $this->lng->loadLanguageModule("wfld");
38 }
global $DIC
Definition: shib_login.php:26

References $DIC, $lng, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getLabel()

ilWorkspaceFolderSorting::getLabel ( int  $option)
protected

Definition at line 65 of file class.ilWorkspaceFolderSorting.php.

65 : string
66 {
67 switch ($option) {
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");
73 }
74 return "";
75 }

References ILIAS\Repository\lng().

Referenced by getOptionsByType().

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

◆ getOptionsByType()

ilWorkspaceFolderSorting::getOptionsByType ( string  $wsp_type,
int  $selected,
int  $parent_effective 
)

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

44 : array {
45 $sort_options = ($wsp_type == "wfld")
46 ? [self::SORT_DERIVED => $this->lng->txt("wfld_derive")]
47 : [];
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);
53 }
54
55 if (isset($sort_options[self::SORT_DERIVED])) {
56 $sort_options[self::SORT_DERIVED] .= " (" . $this->getLabel($parent_effective) . ")";
57 }
58
59 if (isset($sort_options[$selected])) {
60 $sort_options[$selected] = "<strong>" . $sort_options[$selected] . "</strong>";
61 }
62 return $sort_options;
63 }

References getLabel(), SORT_ALPHABETICAL_ASC, SORT_ALPHABETICAL_DESC, SORT_CREATION_ASC, and SORT_CREATION_DESC.

+ Here is the call graph for this function:

◆ sortNodes()

ilWorkspaceFolderSorting::sortNodes ( array  $nodes,
int  $sorting 
)

Definition at line 77 of file class.ilWorkspaceFolderSorting.php.

77 : array
78 {
79 switch ($sorting) {
81 $nodes = ilArrayUtil::sortArray($nodes, "title", "asc");
82 break;
84 $nodes = ilArrayUtil::sortArray($nodes, "title", "desc");
85 break;
87 $nodes = ilArrayUtil::sortArray($nodes, "create_date", "asc");
88 break;
90 $nodes = ilArrayUtil::sortArray($nodes, "create_date", "desc");
91 break;
92 }
93 return $nodes;
94 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)

References ilArrayUtil\sortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilWorkspaceFolderSorting::$lng
protected

Definition at line 27 of file class.ilWorkspaceFolderSorting.php.

Referenced by __construct().

◆ SORT_ALPHABETICAL_ASC

const ilWorkspaceFolderSorting::SORT_ALPHABETICAL_ASC = 1

◆ SORT_ALPHABETICAL_DESC

const ilWorkspaceFolderSorting::SORT_ALPHABETICAL_DESC = 2

Definition at line 23 of file class.ilWorkspaceFolderSorting.php.

Referenced by getOptionsByType().

◆ SORT_CREATION_ASC

const ilWorkspaceFolderSorting::SORT_CREATION_ASC = 3

Definition at line 24 of file class.ilWorkspaceFolderSorting.php.

Referenced by getOptionsByType().

◆ SORT_CREATION_DESC

const ilWorkspaceFolderSorting::SORT_CREATION_DESC = 4

Definition at line 25 of file class.ilWorkspaceFolderSorting.php.

Referenced by getOptionsByType().

◆ SORT_DERIVED

const ilWorkspaceFolderSorting::SORT_DERIVED = 0

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