ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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: feed.php:28
+ 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.

References ILIAS\Repository\lng().

Referenced by getOptionsByType().

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  }
+ 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.

References getLabel(), and ILIAS\Repository\lng().

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  }
+ Here is the call graph for this function:

◆ sortNodes()

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

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

References ilArrayUtil\sortArray().

77  : array
78  {
79  switch ($sorting) {
80  case self::SORT_ALPHABETICAL_ASC:
81  $nodes = ilArrayUtil::sortArray($nodes, "title", "asc");
82  break;
83  case self::SORT_ALPHABETICAL_DESC:
84  $nodes = ilArrayUtil::sortArray($nodes, "title", "desc");
85  break;
86  case self::SORT_CREATION_ASC:
87  $nodes = ilArrayUtil::sortArray($nodes, "create_date", "asc");
88  break;
89  case self::SORT_CREATION_DESC:
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)
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilWorkspaceFolderSorting::$lng
protected

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

◆ 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.

◆ SORT_CREATION_ASC

const ilWorkspaceFolderSorting::SORT_CREATION_ASC = 3

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

◆ SORT_CREATION_DESC

const ilWorkspaceFolderSorting::SORT_CREATION_DESC = 4

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

◆ SORT_DERIVED

const ilWorkspaceFolderSorting::SORT_DERIVED = 0

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